<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/620" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2007-08-01T16:43:37+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/620</id>

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-08-01T16:43:37+02:00</updated>

		<published>2007-08-01T16:43:37+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=620&amp;p=1872#p1872</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=620&amp;p=1872#p1872"/>
		<title type="html"><![CDATA[HIDKeys and UART]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=620&amp;p=1872#p1872"><![CDATA[
This looks like a stack overflow to me. The device would not suffer a RESET otherwise. Or a hardware problem which triggers brownout or other sources of reset.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Wed Aug 01, 2007 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2007-07-31T12:55:45+02:00</updated>

		<published>2007-07-31T12:55:45+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=620&amp;p=1837#p1837</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=620&amp;p=1837#p1837"/>
		<title type="html"><![CDATA[HIDKeys and UART]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=620&amp;p=1837#p1837"><![CDATA[
Hi everybody,<br /><br />I've got an intriguing question on HIDkeys and UART. <br />My firmware should run in the following way: <br />whenever the attiny2313 running HIDkeys receives a message on the<br />UART it should simulate pressing a key on the keyboard. The HIDkeys runs<br />without problems, with a button attached to the attiny I can make it work fine.<br /><br />Unfortunately I have strange problems with UART. The following is the main loop<br />of &quot;my&quot; (yeah, it is rather yours) firmware.<br /><br />for(;;){    <br />  //wdt_reset(); /* watchdog is DISABLED for now */<br />  usbPoll();<br />  if(UCSRA &amp; (1 &lt;&lt; RXC)){ <br />    // received data, pull that data out of the internal buffer<br />    j=UDR;<br />    //if (j=='d') {<br />      state=STATE_SEND_KEY_DOWN;<br />    //}<br />  }<br /><br /><br />  if (state!=STATE_IDLE &amp;&amp; usbInterruptIsReady()) {<br />    if (state==STATE_SEND_KEY_DOWN) {<br />      key = 1;<br />    } else if (state==STATE_SEND_KEY_UP) {<br />      key = 0;<br />    }<br />    state--;<br />    buildReport(key);<br />    usbSetInterrupt(reportBuffer, sizeof(reportBuffer));<br />   }<br />}<br /><br />If defined this way, it works -- every time I get something on the USART (and here<br />it doesn't matter what it is), a key-press is simulated. <br />Now the strange thing comes: when I enable the innocent &quot;if (j=='d')&quot; the whole<br />thing stops working. Whenever I send something on the UART ('d' or not 'd'), the<br />firmware seems to reset, i.e. a new enumeration is started on windows. The device<br />fails to simulate any key presses.<br /><br />When I was trying to make this run at all (without UART, with a button) I have had<br />this strange resettings already. I had the impression that it was sometimes<br />one line of simple code added in the main-loop which made this happen. This looks<br />a little like timing problems to me, but I do not have an idea why exactly this <br />could have happened.<br /><br />Do you have an idea in which direction I should look? If you have any concrete<br />tests I could run, let me know, I'll be happy to provide you with more information.<br /><br />Regards,<br /><br />Jarek<p>Statistics: Posted by Guest — Tue Jul 31, 2007 12:55 pm</p><hr />
]]></content>
	</entry>
	</feed>
