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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2009-12-18T13:21:56+02:00</updated>

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

		<entry>
		<author><name><![CDATA[winterflood_j]]></name></author>
		<updated>2009-12-18T13:21:56+02:00</updated>

		<published>2009-12-18T13:21:56+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12528#p12528</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12528#p12528"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12528#p12528"><![CDATA[
<blockquote><div><cite>Grendel wrote:</cite>Anyway, what are your fuse values ? You need to set the BOOTSZ bits to 1024 words (2kbytes), BOOTRST needs to be enabled.</div></blockquote><br />My flags are:<br /># <!-- m --><a class="postlink" href="http://www.engbedded.com/fusecalc/">http://www.engbedded.com/fusecalc/</a><!-- m --><br />#<br />#Features<br /># Ext. Full-swing Crystal, Ceramic resonator, BOD enabled, Start-up Time PWRDN/RESET 1K CK/14 CK + 0ms; [CKSEL=0110 SUT=10]<br /># Clock output on PORTB0; [CKOUT=0]<br /># Boot Reset vector Enabled (default address=$0000); [BOOTRST=0]<br /># Boot Flash section size=2048 words Boot start adress=$3800; [BOOTSZ=00]; default value<br /># Serial program downloading (SPI) enabled; [SPIEN=0]<br />#<br /># Low:0XA6<br /># High:0xD8<br /># Ext:0xFC/04<br /><br />And so I should use Word@$3800 ie. Byte@$7000 for the start of .text<br />My makefile was using Byte@$3800...<br />Fixing this turns on the 2nd LED indicating the atmega entered the ISR<br /><br />Following this, I suspect that the atmega was originally doing this (it was erased before loading the bootloader):<br /><br />Start at Word@$3800<br />execute NOPs until the end of pgm space and loop to $0000<br />execute NOPs until Byte@$3800 and start bootloader<br /><br />on ISR, jump to Word@$3802<br />execute NOPs until the end of pgm space and loop to $0000<br />execute NOPs until Byte@$3800 and restart bootloader<br /><br />My LED scheme was not detecting this since this is a &quot;soft&quot; reset, the LEDs were not turned off so the delay did not show; adding a line to turn them off before the delay corroborates this.<br /><br />So the non-firing ISR problem is solved<br />However, the PC was still not happy.<br /><br />I removed my two extra ASM lines, and it now connects OK:<br />[1550409.541237] usb 4-1: new low speed USB device using uhci_hcd and address 33<br />[1550409.712858] usb 4-1: configuration #1 chosen from 1 choice<br /><br />This is with:<br />1.5K pullup on a separate line<br />100ohm resistors to the data lines<br />3.3V Zeners (will try 3.6V ones when I get them...)<br /><br />On the particular PCs I have here, the Zeners are necessary<br /><br />Now to try bootloading!<br /><br />Thanks for your help<br />Jonathan<br /><br />[Edit: I thought I needed the 2048 words bootload area, but turns out it's 1848 bytes including my fiddling, so I can probably go to 1024 words (I probably originally thought it was 1024 bytes)]<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3214">winterflood_j</a> — Fri Dec 18, 2009 1:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2009-12-15T09:32:56+02:00</updated>

		<published>2009-12-15T09:32:56+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12495#p12495</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12495#p12495"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12495#p12495"><![CDATA[
Oops, skimmed right over that, sorry.<br /><br />Very odd. I used the same BL w/ a mega8 w/o problems but later switched to <a href="http://www.obdev.at/products/vusb/bootloadhid.html" class="postlink">bootloadHID</a> since it doesn't need special kernel drivers.<br /><br />Anyway, what are your fuse values ? You need to set the BOOTSZ bits to 1024 words (2kbytes), BOOTRST needs to be enabled. The loader text segment needs to be located at 0x3C00 (this is a word address !), starting w/ the vector table. W/ AVR Studio this would be set under Project-&gt;Configuration Option-&gt;Memory Settings. Add the entry: Memory type Flash, Name .text, Address 0x3C00. If you use a modified Makefile, the define BOOTLOADER_ADDRESS needs to be 7800.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Tue Dec 15, 2009 9:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[winterflood_j]]></name></author>
		<updated>2009-12-15T03:53:26+02:00</updated>

		<published>2009-12-15T03:53:26+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12493#p12493</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12493#p12493"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12493#p12493"><![CDATA[
<blockquote><div><cite>Grendel wrote:</cite>After defining the ID resistor you need to explicitly connect it via usbDeviceConnect() .</div></blockquote><br />Thanks<br /><br /><blockquote><div><cite>Grendel wrote:</cite>Wait a second -- 328p ?  Did you see <a href="http://forums.obdev.at/viewtopic.php?p=11936#p11936" class="postlink">this</a> ?</div></blockquote><br />Yup:<br /><blockquote><div><cite>Jonathan wrote:</cite>I saw this post:<br /><a href="http://forums.obdev.at/viewtopic.php?p=11936#p11936" class="postlink">viewtopic.php?f=8&amp;t=2663#p11936</a><br />and therefore changed line 60 in usbdrvasm.S to:<br /># ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */<br /># define USB_INTR_VECTOR INT0_vect<br /># endif<br />But to no avail<br /></div></blockquote><br />This correction might not be right, which is why I posted it, but I think it is, based on the disassembly:<br /><br /><div class="codebox"><p>Code: </p><pre><code>&#91;usbdvrasm20.inc:49&#93;<br />USB_INTR_VECTOR:<br />;order of registers pushed: YL, SREG YH, &#91;sofError&#93;, bitcnt, shift, x1, x2, x3, x4, cnt<br />    push    YL                  ;&#91;-28&#93; push only what is necessary to sync with edge ASAP<br />    in      YL, SREG            ;&#91;-26&#93;<br />    push    YL                  ;&#91;-25&#93;<br />    push    YH                  ;&#91;-23&#93;<br />    <br />;jo<br />   ldi r16, 0xFF;<br />   out PORTD, r16;<br />;/jo<br />;----------------------<br />&#91;...&#93;<br />waitForJ:<br />    inc     YL<br />    sbis    USBIN, USBMINUS<br />...<br /></code></pre></div><br /><br /><div class="codebox"><p>Code: </p><pre><code>00003800 &lt;__vectors&gt;:<br />    3800:   0c 94 61 1c    jmp   0x38c2   ; 0x38c2 &lt;__ctors_end&gt;<br />    3804:   0c 94 9c 1d    jmp   0x3b38   ; 0x3b38 &lt;__vector_1&gt;<br />    3808:   0c 94 7e 1c    jmp   0x38fc   ; 0x38fc &lt;__bad_interrupt&gt;<br />    380c:   0c 94 7e 1c    jmp   0x38fc   ; 0x38fc &lt;__bad_interrupt&gt;<br />&#91;...&#93;<br />00003b38 &lt;__vector_1&gt;:<br />    3b38:   cf 93          push   r28<br />    3b3a:   cf b7          in   r28, 0x3f   ; 63<br />    3b3c:   cf 93          push   r28<br />    3b3e:   df 93          push   r29<br />    3b40:   0f ef          ldi   r16, 0xFF   ; 255<br />    3b42:   0b b9          out   0x0b, r16   ; 11<br /><br />00003b44 &lt;waitForJ&gt;:<br />    3b44:   c3 95          inc   r28<br />    3b46:   48 9b          sbis   0x09, 0   ; 9<br />....<br /></code></pre></div><br /><br />I have setup my circuit to use a pull-up separately from /RESET, added a 4-second delay on boot (before usbDeviceConnect()) [had to compile it separately so I could use -O0 on the delay and -Os on the rest of vusb]<br />In this configuration, I get a delay on boot before anything happens, then the 'entering bootloader' LED lights, the PC detects the device, and that's it...<br />The 'entered interrrupt' LED does not turn on, and the AVR does not reboot (it cant, really, since D* are not at all connected to /RESET anymore)<br /><br />Looks like I'm gonna have to write a test program to see if I can get INT0 to work at all separately of vusb.<br />Maybe the vector relocation used in the bootloader is broken somehow?<br /><br /><div class="codebox"><p>Code: </p><pre><code>int main(void) {<br />   delay_ms_20m(4000);<br />   <br />   /* initialize hardware */<br />   BOOTLOADER_INIT<br /><br />   /* jump to application if jumper is set */<br />   if (!BOOTLOADER_CONDITION) {<br />      leaveBootloader();<br />   }<br /><br />   MCUCR = (1 &lt;&lt; IVCE);  /* enable change of interrupt vectors */<br />   MCUCR = (1 &lt;&lt; IVSEL); /* move interrupts to boot flash section */<br /><br />   usbInit();<br />   sei();<br />   usbDeviceConnect();<br />   for(;;){   /* main event loop */<br />     usbPoll();<br />   }<br />   return 0;<br />}<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3214">winterflood_j</a> — Tue Dec 15, 2009 3:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2009-12-08T20:05:32+02:00</updated>

		<published>2009-12-08T20:05:32+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12338#p12338</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12338#p12338"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12338#p12338"><![CDATA[
Wait a second -- 328p ?  Did you see <a href="http://forums.obdev.at/viewtopic.php?p=11936#p11936" class="postlink">this</a> ?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Tue Dec 08, 2009 8:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2009-12-06T04:32:19+02:00</updated>

		<published>2009-12-06T04:32:19+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12279#p12279</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12279#p12279"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12279#p12279"><![CDATA[
After defining the ID resistor you need to explicitly connect it via usbDeviceConnect() .<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Sun Dec 06, 2009 4:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[winterflood_j]]></name></author>
		<updated>2009-12-05T10:00:25+02:00</updated>

		<published>2009-12-05T10:00:25+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12266#p12266</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12266#p12266"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12266#p12266"><![CDATA[
<blockquote><div><cite>Grendel wrote:</cite>Bad Zeners would be my guess. For P type AVRs you really need 3.6V Z-diodes that are &lt;= 500mW.</div></blockquote><br /><br />Unfortunately the electronics shop here only had 3.3 and 3.9 Zeners  <img class="smilies" src="./../../../images/smilies/icon_sad.gif" alt=":(" title="Sad" />  maybe they can order others though (If i can explain that in Japanese...)<br />Indeed the effect of these is that the polarizing current is too low, resulting in 2.2V (with the 1.5k pull-up, I can't measure the voltage when driven by the PC as it's too fast for a multimeter), which might be too low to register on the AVR.<br /><br />This is why I also tried with no Zener, and even manually (AVR should detect the input with no problem, even though communication might not work), but it seems that even then the ISR is not called.<br /><br /><blockquote><div><cite>Saimon wrote:</cite>It is not good idea to write code to asm source.</div></blockquote><br />I fully understand editing the ASM source will probably kill the driver, but as soon as I know the ISR is firing, I will remove those lines.<br />Any other reason?<br /><br /><blockquote><div><cite>Saimon wrote:</cite>Try to use another 1,5k pull-up for D- data line(may be you AVR reset at d- level change).<br />Best regards, Saimon!</div></blockquote><br />Indeed, I see that /RESET needs 0.9Vcc to guarantee a High value; my setup breaks this:<br />(Vcc---1.5K---/RESET----1.5K----D- ----15K----GND -&gt; /RESET will be Vcc*0.916 when D- is on pulldown) (so the AVR can boot)<br />(Vcc---1.5K---/RESET----1.5K----D- ----GND  -&gt; /RESET will be Vcc*0.5 when D- is low) (so the AVR might reset)<br />I suppose a PNP or P-channel FET could be used to get this functionality, or using v-usb to drive the pull-up.<br /><br />I thought of adding a bootup delay to see the reset, but that might make the AVR miss the USB initialization from the host unless I or v-usb drive the pullup only after the delay.<br />That said, Ubuntu seems to try initialization 4 times, So it might still work (I think I'll go with a delay and a driven pullup nonetheless)<br />I shall try again with separate pull-ups, and also add a boot-up delay, and keep you posted<br /><br />Does v-usb automatically drive the pullup on init if it's defined in the config files, or do I need to explicitly connect?<br /><br />Thanks for your help,<br />Jonathan<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3214">winterflood_j</a> — Sat Dec 05, 2009 10:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2009-12-04T19:16:12+02:00</updated>

		<published>2009-12-04T19:16:12+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12253#p12253</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12253#p12253"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12253#p12253"><![CDATA[
It is not good idea to write code to asm source. Try to use another 1,5k pullup for D- data line(may be you AVR reset at d- level change).<br />Best regards, Saimon!<p>Statistics: Posted by Guest — Fri Dec 04, 2009 7:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2009-12-04T05:18:34+02:00</updated>

		<published>2009-12-04T05:18:34+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12247#p12247</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12247#p12247"/>
		<title type="html"><![CDATA[Re: Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12247#p12247"><![CDATA[
Bad Zeners would be my guess. For P type AVRs you really need 3.6V Z-diodes that are &lt;= 500mW.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Fri Dec 04, 2009 5:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[winterflood_j]]></name></author>
		<updated>2009-12-03T20:35:21+02:00</updated>

		<published>2009-12-03T20:35:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12241#p12241</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12241#p12241"/>
		<title type="html"><![CDATA[Device descriptor read/64, error -71; no ISR?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3601&amp;p=12241#p12241"><![CDATA[
Hi all,<br /><br />I am trying to port avrusbboot from <!-- m --><a class="postlink" href="http://www.fischl.de">http://www.fischl.de</a><!-- m --> to the latest (2009-08-22) version of v-usb<br />I am using an atmega 328p at 20MHz, crystal oscillator (supported by the latest v-usb, but not the one in arvusbboot)<br /><br />I am using the following circuit:<br />Vcc is 5V (3.3V is not enough for 20MHz)<br />1.5k pullup from D- to RESET, 1.5k pullup from there to Vcc (causes a reconnect when the programmer resets the chip or I push the reset button)<br />100ohm resistors on Dx to PortDx<br />3.3V Zeners (no 3.6V ones in the shop <img class="smilies" src="./../../../images/smilies/icon_sad.gif" alt=":(" title="Sad" /> )<br />1M pulldown on D+ (for when the cable is unplugged)<br /><br />D- goes to PortD0, D+ to PortD2/INT0<br /><br />PORTD1,3 are debug LEDs, I turn on PORTD1 on entering the bootloader (before any usb setup), and the other one when leaving (test for the bootloader condition and boot sector use)<br /><br />After some modifications, the code compiles<br />So far, the LEDs indicate I am entering the bootloader properly, but the device is not responding on usb:<br />dmesg says:<br />[284388.070538] usb 4-1: new low speed USB device using uhci_hcd and address 64<br />[284388.190169] usb 4-1: device descriptor read/64, error -71<br />[284388.413460] usb 4-1: device descriptor read/64, error -71<br />[284388.628777] usb 4-1: new low speed USB device using uhci_hcd and address 65<br />[284388.748406] usb 4-1: device descriptor read/64, error -71<br />[284388.971697] usb 4-1: device descriptor read/64, error -71<br />[284389.187012] usb 4-1: new low speed USB device using uhci_hcd and address 66<br />[284389.593728] usb 4-1: device not accepting address 66, error -71<br />[284389.705381] usb 4-1: new low speed USB device using uhci_hcd and address 67<br />[284390.112088] usb 4-1: device not accepting address 67, error -71<br /><br />I saw this post:<br /><!-- l --><a class="postlink-local" href="http://forums.obdev.at/viewtopic.php?f=8&amp;t=2663#p11936">viewtopic.php?f=8&amp;t=2663#p11936</a><!-- l --><br />and therefore changed line 60 in usbdrvasm.S to:<br />#   ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */<br />#       define USB_INTR_VECTOR  INT0_vect<br />#   endif<br />But to no avail <br /><br />I suspected the ISR was not firing (based on aforementioned post and others), so I added these lines to usbavrdrvasm20.inc:<br />line 55&gt;<br />;jo<br />ldi r16, 0xFF;<br />out PORTD, r16;<br />;/jo<br /><br />I know this will clobber whatever might be in r16, screw up timing, and also activate D+/D- pullups, but at this point I don't care if it crashes completely, as long as it tells me the ISR is called...<br />This code might be very wrong, I'm new to avr assembly<br />The result was:<br />* Code size grew by 4 bytes (sounds right to me)<br />* The second LED on PortD does not turn on, even though the PC clearly toggles D- (I placed LEDs on Dx, and they shimmer on reconnect)<br />I tried without the Zeners, but no change (D+ is at 2.2V when only the pullup is driving it with the 3.3V Zeners, so maybe the level was too low to register as HIGH)<br />I tried connecting PortD2 to GND then Vcc manually after starting the circuit (should trigger a interrupt, no?), but the LED still does not turn on<br /><br />This seems to indicate that the ISR is not called, any ideas as to why/where to look?<br /><br />Thanks in advance,<br />Jonathan<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3214">winterflood_j</a> — Thu Dec 03, 2009 8:35 pm</p><hr />
]]></content>
	</entry>
	</feed>
