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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2012-08-21T08:08:59+02:00</updated>

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

		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-21T08:08:59+02:00</updated>

		<published>2012-08-21T08:08:59+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22500#p22500</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22500#p22500"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22500#p22500"><![CDATA[
Ah, Cool. Thanks!<br /><br />Yes, that fixed it. Yay \o/ <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=7246">gruvin</a> — Tue Aug 21, 2012 8:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2012-08-20T16:41:23+02:00</updated>

		<published>2012-08-20T16:41:23+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22495#p22495</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22495#p22495"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22495#p22495"><![CDATA[
<blockquote><div><cite>gruvin wrote:</cite>UPDATE:<br />... that #ifdef <em class="text-italics">should</em> resolve to TRUE, but in fact only the second macro is defined, thus preventing the correct Flash page from being read.</div></blockquote><br /><br />Yes, that's a bug, the order of includes is wrong: usbportability.h is included before usbconfig.h. To fix it, simply delete the include of usbportability.h in usbdrv.c. This fix will be in the next release.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Aug 20, 2012 4:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-19T11:41:51+02:00</updated>

		<published>2012-08-19T11:41:51+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22486#p22486</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22486#p22486"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22486#p22486"><![CDATA[
UPDATE<br /><br />Another wee bug for device with a lot of Flash. I had to change the following line in main.c ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>*data = pgm_read_byte((void *)CURRENT_ADDRESS);<br /></code></pre></div><br /><br />... to ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>*data = pgm_read_byte_far(CURRENT_ADDRESS);<br /></code></pre></div><br /><br />Hmmm, for compatibility with smaller ATmega's still, I probably should have made it ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#if (FLASHEND) &gt; 0xffff /* we need long addressing */<br />*data = pgm_read_byte_far(CURRENT_ADDRESS);<br />#else<br />*data = pgm_read_byte((void *)(unsigned)CURRENT_ADDRESS);<br />#endif<br /></code></pre></div><br /><br />(<em class="text-italics">Would anyone more knowledgeable than I, regards PROGMEM etc like to comment? *shrug*</em>)<br /><br />In any case, without this change, USBasp Flash reads resulted in the same 64Kbyte address space being read over and over, instead of progressing to the next bank as they should. First indication of this fault was &quot;Verify failed. First mismatch at 0x10000&quot;.<br /><br />Seems I now have a fully functioning<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7246">gruvin</a> — Sun Aug 19, 2012 11:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-19T09:34:17+02:00</updated>

		<published>2012-08-19T09:34:17+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22485#p22485</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22485#p22485"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22485#p22485"><![CDATA[
UPDATE<br /><br />Code reformed to avoid the compiler warning about type casting ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#define USB_READ_FLASH(addr)    pgm_read_byte_far(0x30000UL + (unsigned)(addr))<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7246">gruvin</a> — Sun Aug 19, 2012 9:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-19T07:04:30+02:00</updated>

		<published>2012-08-19T07:04:30+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22483#p22483</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22483#p22483"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22483#p22483"><![CDATA[
UPDATE:<br /><br />I have confirmed that the wrong USB_READ_FLASH macro is being defined, in usbdrv/usbportatbility.h ...<br /><div class="codebox"><p>Code: </p><pre><code>#ifdef USB_CFG_DRIVER_FLASH_PAGE<br />#   define USB_READ_FLASH(addr)    pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE &lt;&lt; 16) | (long)(addr))<br />#else<br />#   define USB_READ_FLASH(addr)    pgm_read_byte(addr)<br />#endif<br /></code></pre></div><br /><br />... that #ifdef <em class="text-italics">should</em> resolve to TRUE, but in fact only the second macro is defined, thus preventing the correct Flash page from being read.<br /><br />Replacing that whole block with ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#define USB_READ_FLASH(addr)    pgm_read_byte_far(0x30000UL | (unsigned long)(addr))</code></pre></div><br /><br />... fixes the problem. I now has a USBasp USB device enumerated! Yay \o/<br /><br />But I don't understand why the #ifdef failed. I definitely have the following in usbconfig.h ..<br /><br /><div class="codebox"><p>Code: </p><pre><code>#define USB_CFG_DRIVER_FLASH_PAGE       3</code></pre></div><br /><br />... and a grep of all files tells me there's no other instances of same, to do any overriding.<br /><br />Anyone?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7246">gruvin</a> — Sun Aug 19, 2012 7:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-19T06:34:32+02:00</updated>

		<published>2012-08-19T06:34:32+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22482#p22482</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22482#p22482"/>
		<title type="html"><![CDATA[Re: V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22482#p22482"><![CDATA[
UPDATE: I just updated the usbdrv/ folder from <em class="text-italics">USBaspLoader.2010-07-27</em> to the latest vusb-20120109 version. No change.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7246">gruvin</a> — Sun Aug 19, 2012 6:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gruvin]]></name></author>
		<updated>2012-08-19T06:28:46+02:00</updated>

		<published>2012-08-19T06:28:46+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22481#p22481</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22481#p22481"/>
		<title type="html"><![CDATA[V-USB on ATmega2560 -- bad descriptor]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6959&amp;p=22481#p22481"><![CDATA[
Hello<br /><br />I'm trying to get <em class="text-italics">USBaspLoader.2010-07-27</em> working on an ATmega2560, in the bootloader area. There seems to be some problem with the device descriptor location in Flash (progmem), despite having ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#define USB_CFG_DRIVER_FLASH_PAGE       3<br /></code></pre></div><br />(My ATmega2560 bootloader is of course installed at 0x3E000.)<br /><br />In my OS X system logs, I'm seeing ...<br /><br /><blockquote class="uncited"><div>The USB Family found a device at  port 2 of hub @ 0x26400000 with a bad USB device descriptor (0xffffffffffffffff, 0x0 )</div></blockquote><br /><br />... which does seem to suggest that empty flash data from the wrong address page is being used.<br /><br />I see in usbdrv/usbportability.h the following ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#ifdef __HAS_ELPM__<br />#   define PROGMEM __farflash<br />#else<br />#   define PROGMEM __flash<br />#endif<br /></code></pre></div><br /><br />... and ...<br /><br /><div class="codebox"><p>Code: </p><pre><code>#if USB_CFG_DRIVER_FLASH_PAGE<br />#   define USB_READ_FLASH(addr)    pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE &lt;&lt; 16) | (long)(addr))<br />#else<br />#   define USB_READ_FLASH(addr)    pgm_read_byte(addr)<br />#endif<br /></code></pre></div><br /><br />... but I am not confident that these are being used (detected) as intended. (And I'm not sure how to test for that. I tried, but failed. :-/ )<br /><br />I'm running on an iMac, under OS X 10.8, with CrossPack-AVR-20120217 (avr-gcc version 4.5.1.)<br /><br />Thanks in advance for any help.<br /><br />Gruvin.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7246">gruvin</a> — Sun Aug 19, 2012 6:28 am</p><hr />
]]></content>
	</entry>
	</feed>
