<?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/1069" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-01-07T20:13:05+02:00</updated>

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

		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2008-01-07T20:13:05+02:00</updated>

		<published>2008-01-07T20:13:05+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3805#p3805</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3805#p3805"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3805#p3805"><![CDATA[
Finally I found the issue: as in most cases, it's located behind the screen  <img class="smilies" src="./../../../images/smilies/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /> <br /><br />The trouble was caused by the pull-up which has been placed between VCC and D+ instead of VCC and D-, so the device always registered as full-speed instead of low-speed.<br /><br />I've looked several times at the pull-up, but due to some strange reasons I thought D+ was the right line. Yesterday late night I had a look at the USB spec and I was wondering why the schematic there looks so wrong .....  <img class="smilies" src="./../../../images/smilies/icon_redface.gif" alt=":oops:" title="Embarassed" /> <br /><br />Now everything works as expected  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /> <br /><br />Christian: thanks for your extensive help and your awesome work! Sorry for the trouble I've caused....<br /><br /><br />Regards,<br />Oliver<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Mon Jan 07, 2008 8:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-12-30T21:03:29+02:00</updated>

		<published>2007-12-30T21:03:29+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3664#p3664</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3664#p3664"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3664#p3664"><![CDATA[
Here are my screenshots from the scope for D+ (channel 1) and D- (channel 2). You can see that the reply from the device is with 5V levels since I omitted the zener diodes. Even with the zeners you should see which is the host's request and which the device reply by the voltage levels.<br /><br /><img src="http://at.obdev.at/ftp/pub/tmp/usb0.gif" class="postimage" alt="Image" /><br /><img src="http://at.obdev.at/ftp/pub/tmp/usb1.gif" class="postimage" alt="Image" /><br /><br />The first image shows an overview of the message exchange, the second is a zoom-in on a different request.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Sun Dec 30, 2007 9:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2007-12-30T19:27:18+02:00</updated>

		<published>2007-12-30T19:27:18+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3663#p3663</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3663#p3663"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3663#p3663"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>If I remember correctly, it does not work regardless of the interrupt in your case.</div></blockquote><br />Right <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" /><br /><br /><br /><blockquote><div><cite>christian wrote:</cite>Let's concentrate on the debug output. You get the startup message and you see USB Reset, but you don't get any data. This can be because the interrupt never occurs or because the data is identified as garbage by the interrupt handler.<br /><br />You should be able to verify whether the interrupt occurs by toggling a LED in the interrupt service routine (temporarily use your own interrupt handler for that).</div></blockquote><br />I have done so - the LED toggles several times after the device has been plugged to the USB. This means that the ISR is triggered as excepted and - following your explanation - the incoming data is garbled or corrupted. Do you have any references (screenshot from oscilloscope) of how the D+ and D- line should look like?<br /><br /><br /><blockquote><div><cite>christian wrote:</cite>If it does occur and the handler thinks the data is garbage, things become harder to debug. You could toggle LEDs in various places in the assembler module, but that's hard if you are not the author of the code.</div></blockquote><br />Ok, any ideas?  <img class="smilies" src="./../../../images/smilies/icon_confused.gif" alt=":?" title="Confused" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Sun Dec 30, 2007 7:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-12-29T18:04:51+02:00</updated>

		<published>2007-12-29T18:04:51+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3661#p3661</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3661#p3661"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3661#p3661"><![CDATA[
I'm beginning to mix up threads. My reply should have gone to another thread where USB works when connected to INT0 but not with any other interrupt.<br /><br />If I remember correctly, it does not work regardless of the interrupt in your case.<br /><br />If the interrupt pin is &quot;open&quot;, then it's normal that it is very sensitive to touching or other changes. But it should be connected to D+ anyway.<br /><br />The warnings are OK. This means that the data type had to be converted for a function call. I'm NOT using WinAVR because I have a Mac, but I know that the driver can be compiled with WinAVR 20070525.<br /><br />Let's concentrate on the debug output. You get the startup message and you see USB Reset, but you don't get any data. This can be because the interrupt never occurs or because the data is identified as garbage by the interrupt handler.<br /><br />You should be able to verify whether the interrupt occurs by toggling a LED in the interrupt service routine (temporarily use your own interrupt handler for that). If it does occur and the handler thinks the data is garbage, things become harder to debug. You could toggle LEDs in various places in the assembler module, but that's hard if you are not the author of the code.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Sat Dec 29, 2007 6:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2007-12-29T13:19:12+02:00</updated>

		<published>2007-12-29T13:19:12+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3656#p3656</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3656#p3656"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3656#p3656"><![CDATA[
Here are the latest results (there's still no change  <img class="smilies" src="./../../../images/smilies/icon_sad.gif" alt=":(" title="Sad" /> ):<br /><br />The interrupttable looks good for INT0 and INT1:<br /><br />INT0:<br /><div class="codebox"><p>Code: </p><pre><code>Disassembly of section .text:<br /><br />00000000 &lt;__vectors&gt;:<br />   0:   0c 94 7f 00    jmp   0xfe   ; 0xfe &lt;__ctors_end&gt;<br />   4:   0c 94 f6 02    jmp   0x5ec   ; 0x5ec &lt;__vector_1&gt;<br />   8:   0c 94 9c 00    jmp   0x138   ; 0x138 &lt;__bad_interrupt&gt;<br />   c:   0c 94 9c 00    jmp   0x138   ; 0x138 &lt;__bad_interrupt&gt;   <br />   ...<br /></code></pre></div><br /><br />INT1:<br /><div class="codebox"><p>Code: </p><pre><code>Disassembly of section .text:<br /><br />00000000 &lt;__vectors&gt;:<br />   0:   0c 94 7f 00    jmp   0xfe   ; 0xfe &lt;__ctors_end&gt;<br />   4:   0c 94 9c 00    jmp   0x138   ; 0x138 &lt;__bad_interrupt&gt;<br />   8:   0c 94 f6 02    jmp   0x5ec   ; 0x5ec &lt;__vector_2&gt;<br />   c:   0c 94 9c 00    jmp   0x138   ; 0x138 &lt;__bad_interrupt&gt;<br />   ...<br /></code></pre></div><br /><br /><br /><blockquote class="uncited"><div>And did you try a different interrupt?</div></blockquote><br />If I'm using INT1 instead of INT0 the device still reacts in the same way. I also tried different configurations (D+ connected to INT0 and nothing else, D+ connected to INT0 and PD2) and different versions of the usb stack (2007/03/29 and 2007/12/01) - nothing helped.<br /><br />It's interesting to see that if I'm using the old usb-stack, I always get the 'toggling behaviour' I described in my very first topic.<br /><br /><br />Now I assume that the problem is coupled to my evaluation board: yesterday I found out that INT0 is <em class="text-italics">very</em> sensitive to any changes. It is sufficient enough to touch the isolated wires on the backside of the circuit board with my finger to trigger the interrupt service routine if no pull-up resistor is connected.<br /><br />I ordered some new parts and I will build another evaluation board with short lines especially dedicated for testing this usb-stuff.<br /><br /><br />If you have another idea where to look please let me know.<br /><br /><br />Lastly, I activated some more compiler-warnings and got some interesting response:<br /><br /><div class="codebox"><p>Code: </p><pre><code>usbdrv/usbdrv.c: In function 'usbSetInterrupt':<br />usbdrv/usbdrv.c:232: warning: passing argument 2 of 'usbCrc16Append' with different width due to prototype<br />usbdrv/usbdrv.c:234: warning: passing argument 1 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c:234: warning: passing argument 3 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c: In function 'usbProcessRx':<br />usbdrv/usbdrv.c:321: warning: passing argument 1 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c:321: warning: passing argument 3 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c: In function 'usbBuildTxBlock':<br />usbdrv/usbdrv.c:470: warning: passing argument 2 of 'usbRead' with different width due to prototype<br />usbdrv/usbdrv.c:472: warning: passing argument 2 of 'usbCrc16Append' with different width due to prototype<br />usbdrv/usbdrv.c:482: warning: passing argument 1 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c:482: warning: passing argument 3 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c: In function 'usbPoll':<br />usbdrv/usbdrv.c:511: warning: passing argument 2 of 'usbProcessRx' with different width due to prototype<br />usbdrv/usbdrv.c:537: warning: passing argument 1 of 'odDebug' with different width due to prototype<br />usbdrv/usbdrv.c:537: warning: passing argument 3 of 'odDebug' with different width due to prototype<br /><br />usbdrv/oddebug.c: In function 'printHex':<br />usbdrv/oddebug.c:34: warning: passing argument 1 of 'hexAscii' with different width due to prototype<br />usbdrv/oddebug.c:34: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br />usbdrv/oddebug.c:35: warning: passing argument 1 of 'hexAscii' with different width due to prototype<br />usbdrv/oddebug.c:35: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br />usbdrv/oddebug.c: In function 'odDebug':<br />usbdrv/oddebug.c:40: warning: passing argument 1 of 'printHex' with different width due to prototype<br />usbdrv/oddebug.c:41: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br />usbdrv/oddebug.c:43: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br />usbdrv/oddebug.c:44: warning: passing argument 1 of 'printHex' with different width due to prototype<br />usbdrv/oddebug.c:46: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br />usbdrv/oddebug.c:47: warning: passing argument 1 of 'uartPutc' with different width due to prototype<br /><br />main.c: In function 'usbFunctionSetup':<br />main.c:240: warning: passing argument 1 of 'buildReport' with different width due to prototype<br />main.c: In function 'main':<br />main.c:268: warning: passing argument 1 of 'odDebug' with different width due to prototype<br />main.c:268: warning: passing argument 3 of 'odDebug' with different width due to prototype<br />main.c:294: warning: passing argument 1 of 'buildReport' with different width due to prototype<br />main.c:295: warning: passing argument 2 of 'usbSetInterrupt' with different width due to prototype<br /></code></pre></div><br /><br />I'm concerned about the warning &quot;passing argument x of 'XYZ' with different width due to prototype&quot; -&gt; I didn't investigate this further but from my experience this point <em class="text-italics">will</em> create problems sooner or later; what do you think about it?<br /><br />Oh, one last point: which version of winAVR are you using? Maybe this is the reason for all my problems.<br />I'm currently using winAVR build 20070525<br /><br /><br />Thanks for your help so far -- have a nice weekend and a happy new year!<br /><br />Regards,<br />Oliver<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Sat Dec 29, 2007 1:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2007-12-28T21:56:40+02:00</updated>

		<published>2007-12-28T21:56:40+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3652#p3652</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3652#p3652"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3652#p3652"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>Did you check the disassembler output to see whether the interrupt table has been compiled correctly?</div></blockquote><br />Can you please give me a hint where I have to look and what it should look like? <br /><br /><blockquote><div><cite>christian wrote:</cite>And did you try a different interrupt?</div></blockquote><br />I tried INT1 instead of INT0 - I connected D+ to INT1 (pin 17) and made following modifications to the code.<br /><br />in main.c (hardwareInit()):<br /><div class="codebox"><p>Code: </p><pre><code>    PORTD = 0xf6;   /* 1111 0110 bin: activate pull-ups except on USB lines */<br />    DDRD = 0x0b;    /* 0000 1011 bin: all pins input except USB &#40;-&gt; USB reset&#41; */<br />    j = 0;<br />    while&#40;--j&#41;&#123;     /* USB Reset by device only required on Watchdog Reset */<br />        i = 0;<br />        while&#40;--i&#41;; /* delay &gt;10ms for USB reset */<br />    &#125;<br />    DDRD = 0x02;    /* 0000 0010 bin: remove USB reset condition */<br /></code></pre></div><br /><br />in usbconfig.h:<br /><div class="codebox"><p>Code: </p><pre><code>#define USB_INTR_CFG_SET        &#40;&#40;1 &lt;&lt; ISC10&#41; | &#40;1 &lt;&lt; ISC11&#41;&#41;<br />#define USB_INTR_ENABLE_BIT     INT1<br />#define USB_INTR_PENDING_BIT    INTF1<br /></code></pre></div><br /><br />Now I get absolutely no reaction on the PC if I connect the device to it - is there any other section I have to modify if I want to use INT1?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Fri Dec 28, 2007 9:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-12-28T19:58:11+02:00</updated>

		<published>2007-12-28T19:58:11+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3646#p3646</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3646#p3646"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3646#p3646"><![CDATA[
ff stands for Reset. It is output as long as the reset condition is detected on the USB. This indicates that at least the I/O pins can be read correctly.<br /><br />Did you check the disassembler output to see whether the interrupt table has been compiled correctly? And did you try a different interrupt?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Dec 28, 2007 7:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2007-12-28T19:54:06+02:00</updated>

		<published>2007-12-28T19:54:06+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3645#p3645</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3645#p3645"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3645#p3645"><![CDATA[
Finaly I was able to log some data via uart: after plug-in of the device, I receive 1 time &quot;00&quot; (1st message) and 15 times &quot;ff&quot; -- that's all. I guess, this isn't a good sign  <img class="smilies" src="./../../../images/smilies/icon_confused.gif" alt=":?" title="Confused" /> <br /><br />Next, I will test if port D works as expected on my ATmega32 - maybe the micro itself has some errors....<br /><br /><br />Anyway, is there any point where I can start to debug the usb-stack? Is there a point which is crucial for establishing a communication via USB? I have plenty of LEDs to connect and a JTAG debugger to dig into the code  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Fri Dec 28, 2007 7:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-12-28T15:40:04+02:00</updated>

		<published>2007-12-28T15:40:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3641#p3641</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3641#p3641"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3641#p3641"><![CDATA[
OK, so let's assume that the fuse values are correct.<br /><br />The debug output is at 19200 bps by default. Since only the TxD pin is used, there is no flow control. I don't know what settings you need for Hyperterminal, though, if you just want to receive data. If you interface to a PC, you need an inverter (and in principle you need a level converter) because RS232 operates with inverted +/- 12 V levels.<br /><br />If you add <br /><br />        DBG1(0x00, 0, 0);<br /><br />to your main() after odDebugInit(), you should at least see this &quot;00&quot; output after startup. Otherwise the driver should print USB Reset (&quot;ff&quot;) and received and transmitted packets.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Dec 28, 2007 3:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2007-12-28T12:20:59+02:00</updated>

		<published>2007-12-28T12:20:59+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3637#p3637</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3637#p3637"/>
		<title type="html"><![CDATA[Problems with HIDkeys on atmega32 @WinXP]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1069&amp;p=3637#p3637"><![CDATA[
<blockquote class="uncited"><div>The ATMega32 should work without any changes, at least at the first glance. I have never used this chip myself, though. It definitely needs other fuse values than the ATMega8. What fuse values do you use? <br /></div></blockquote><br />The lfuse is programmed to 0x9F, the hfuse to 0x09 -- these are the same settings as on the atmega8, the only difference is that the jtag-interface of the atmega32 is enabled (JTAGEN=0, OCDEN=0).<br />I compared the suggestions in the makefile with the settings I made to the atmega32 with the help of the 'AVR Fuse Calculator' (<a href="http://palmavr.sourceforge.net/cgi-bin/fc.cgi?P_PREV=ATmega32" class="postlink">http://palmavr.sourceforge.net/cgi-bin/fc.cgi?P_PREV=ATmega32</a>)  just to prevent errors from wrong fuses.<br /><br /><br /><blockquote class="uncited"><div>If you don't see any debug output when debugging is enabled, the bit rate may be wrong. This would be a strong hint that you run the MCU from the internal RC oscillator instead of the crystal.<br /></div></blockquote><br />I've ensured that the micro is running on crystal clock the following way: I toggle a LED if timer1 overflows. timer1 is configured in that way, that the LED should toggle with a period of 1s (extClk=12MHz, prescaler=256 countvalue=46875   ==&gt;  period=1s) -- this works.<br />If the system would run on internal oscillator (1MHz) the LED would toggle about every 12s.<br /><br />I know, this isn't a very exact method, but it's sufficient to prove the micro is running with the right clock.<br /><br />Anyway, what are the settings I have to make in Hyperterminal to see any messages from the device (Baudrate, Datab bits, Parity, Stopp bits, Flow control)?<br /><br />Regards,<br />Oliver<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Fri Dec 28, 2007 12:20 pm</p><hr />
]]></content>
	</entry>
	</feed>
