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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2006-12-05T23:37:04+02:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2006-12-05T23:37:04+02:00</updated>

		<published>2006-12-05T23:37:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=303#p303</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=303#p303"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=303#p303"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>This one is tricky <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" /><br /><br /><blockquote class="uncited"><div>10: c0 01 00 00 00 00 00 04 <br /></div></blockquote><br /><br />The last two bytes here indicate a length of 0x400 = 1024 bytes. That's more than the maximum of 254 which is allowed by AVR-USB.<br /><br />The driver evaluates only the low byte of the length (since 254 can be expressed in one byte). And the low byte of 0x400 is 0, which indicates a zero sized read.<br /><br />Simply change the host code to<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,RTEST, 0, 0, buf, 254, 1000&#41;;<br /></code></pre></div><br /><br />(assuming that the buffer is always at least 254 bytes in size).</div></blockquote><p>Statistics: Posted by Guest — Tue Dec 05, 2006 11:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2006-11-21T19:27:52+02:00</updated>

		<published>2006-11-21T19:27:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=165#p165</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=165#p165"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=165#p165"><![CDATA[
tricky indeed <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=";-)" title="Wink" /><br /><br /><br /><div class="codebox"><p>Code: </p><pre><code>10: c0 01 00 00 00 00 fe 00<br />sr20: 4b 00 00<br /></code></pre></div><br />So now it works <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=";-)" title="Wink" /><br /><br />Thankyou very much!<br /><br />Best regards, <br />   Tobias<p>Statistics: Posted by Guest — Tue Nov 21, 2006 7:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2006-11-21T18:59:06+02:00</updated>

		<published>2006-11-21T18:59:06+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=164#p164</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=164#p164"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=164#p164"><![CDATA[
This one is tricky <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" /><br /><br /><blockquote class="uncited"><div>10: c0 01 00 00 00 00 00 04 <br /></div></blockquote><br /><br />The last two bytes here indicate a length of 0x400 = 1024 bytes. That's more than the maximum of 254 which is allowed by AVR-USB.<br /><br />The driver evaluates only the low byte of the length (since 254 can be expressed in one byte). And the low byte of 0x400 is 0, which indicates a zero sized read.<br /><br />Simply change the host code to<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,RTEST, 0, 0, buf, 254, 1000&#41;;<br /></code></pre></div><br /><br />(assuming that the buffer is always at least 254 bytes in size).<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Tue Nov 21, 2006 6:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2006-11-21T18:31:21+02:00</updated>

		<published>2006-11-21T18:31:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=163#p163</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=163#p163"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=163#p163"><![CDATA[
Performing<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,RTEST, 0, 0, buf, sizeof&#40;buffer&#41;, 1000&#41;;</code></pre></div><br />yields <br /><div class="codebox"><p>Code: </p><pre><code>10: c0 01 00 00 00 00 00 04<br />s20: 4b 00 00<br /></code></pre></div> <br />on the serial console with debuglevel=2.<br /><br />The 's' marks the entry to usbFunctionSetup();<br /><br />Below is the trace of sending &quot;asdasdasdasd\0&quot;.<br /><div class="codebox"><p>Code: </p><pre><code>10: 40 02 00 00 00 00 13 00<br />s13: 61 73 64 61 73 64 61 73<br />w20: 4b 00 00<br />13: 64 61 73 64 61 73 64 61<br />w20: 4b 00 00<br />13: 73 64 0a<br />w20: 4b 00 00<br /></code></pre></div><br /><br />Is there more information i should provide?<br /><br />I get the linker-error about missing the usbFunctionRead() symbol as i should.<p>Statistics: Posted by Guest — Tue Nov 21, 2006 6:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2006-11-21T10:54:43+02:00</updated>

		<published>2006-11-21T10:54:43+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=156#p156</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=156#p156"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=156#p156"><![CDATA[
Did you ensure that you recompiled the driver after defining USB_CFG_IMPLEMENT_FN_READ? Our makefiles don't have dependencies on usbconfig.h, so you must do a &quot;make clean&quot; after updating this header.<br /><br />You can verify that usbFunctionRead() is actually linked by changing the name of your function. You should get a linker error when linking.<br /><br />If that's all OK, please enable debugging by adding -DDEBUG_LEVEL=2 to the compiler command line. This will give more information about data received and actions taken.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Tue Nov 21, 2006 10:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2006-11-20T17:32:06+02:00</updated>

		<published>2006-11-20T17:32:06+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=64&amp;p=148#p148</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=64&amp;p=148#p148"/>
		<title type="html"><![CDATA[Problems getting usbFunctionRead() called]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=64&amp;p=148#p148"><![CDATA[
I have a problem with AVR-USB and control-in transfers.<br /><br />USB_CFG_IMPLEMENT_FN_READ and USB_CFG_IMPLEMENT_FN_WRITE<br />are both defined to 1.<br /><br />The device gets detected without problems.<br /><br />The codesnippet below is the content of the <br />callbacks<br /><div class="codebox"><p>Code: </p><pre><code>uchar usbFunctionSetup&#40;uchar data&#91;8&#93;&#41;<br />&#123;<br /> uart_putc&#40;'s'&#41;;<br /> switch&#40;data&#91;1&#93;&#41;&#123;<br />    case STEST:&#123;<br />        buffer&#91;0&#93;=1;<br />        usbMsgPtr=buffer;<br />        return 1;<br />    &#125;break;  <br />    case RTEST:&#123;<br />        return 0xff; // get usbFunctionRead called;<br />    &#125;break;<br />    case WTEST:&#123;<br />        return 0xff; // get usbFunctionWrite called;<br />    &#125;break;<br /> &#125;<br />&#125;<br /><br />uchar usbFunctionWrite&#40;uchar* data,uchar len&#41;<br />&#123;<br />  uart_putc&#40;'w'&#41;;<br />  return 1;<br />&#125;<br /><br />uchar usbFunctionRead&#40;uchar* data,uchar len&#41;<br />&#123;<br />  uart_putc&#40;'r'&#41;;<br />  return 1;<br />&#125;<br /><br /><br /></code></pre></div><br /><br />On the client side:<br /><br />Performing<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_OUT,WTEST, 0, 0, buf, strlen&#40;buffer&#41;, 1000&#41;;</code></pre></div><br />Results in &quot;sw&quot; in the terminal app and usbFunctionWrite getting called.<br /><br />Performing<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,STEST, 0, 0, buf, sizeof&#40;buffer&#41;, 1000&#41;;</code></pre></div><br />Results in &quot;s&quot; in the terminal app and correct data getting returned<br />to the client app.<br /><br />Performing<br /><div class="codebox"><p>Code: </p><pre><code>usb_control_msg&#40;hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,RTEST, 0, 0, buf, sizeof&#40;buffer&#41;, 1000&#41;;</code></pre></div><br />Results in &quot;s&quot; in the terminal app and no usbFunctionRead getting called.<br />Thus no data is supplied to the client application.<br /><br />I'm using AVR-USB on an mega8515 with 8kb of external sram.<br />I thought of usbFunctionRead as a Way to conveniently read the<br />xmem in larger chunks than 254. <br />The firmware code contains atm just the xmem initialization, since i am trying to understand where the problem lies.<br /><br />The usbdriver is from the latest PowerSwitcher zipfile.<br /><br />Best Regards,<br />  Tobias<p>Statistics: Posted by Guest — Mon Nov 20, 2006 5:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
