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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2009-04-25T11:58:16+02:00</updated>

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

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2009-04-25T11:58:16+02:00</updated>

		<published>2009-04-25T11:58:16+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9061#p9061</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9061#p9061"/>
		<title type="html"><![CDATA[Re: alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9061#p9061"><![CDATA[
If you poll from the host, you don't need the interrupt endpoint at all. You can read chunks of 12 bytes at once (well, the driver splits it up into 8 byte chunks for you). And you could use a flag to indicate whether the current buffer has already been transferred.<br /><br />However, I really doubt that polling is faster than the interrupt endpoint solution. It may be faster on a particular host/operating system combination, but not in general.<br /><br />You may try to reduce the polling interval for the interrupt endpoint. Most operating systems accept intervals of less than 10 ms, I think.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Sat Apr 25, 2009 11:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psc]]></name></author>
		<updated>2009-04-24T18:11:07+02:00</updated>

		<published>2009-04-24T18:11:07+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9057#p9057</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9057#p9057"/>
		<title type="html"><![CDATA[Re: alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9057#p9057"><![CDATA[
Hi Christian,<br /><br />I am trying to save times in communication between the firmware and the host.<br /><br />The host application is sending CMD_POLL every 10 ms:<br /><div class="codebox"><p>Code: </p><pre><code>nBytes = usb_control_msg(x-&gt;dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CMD_POLL, 0, 0, (char *)buffer, sizeof(buffer), 10);<br /></code></pre></div><br />The firmware reply like this:<br /><div class="codebox"><p>Code: </p><pre><code>static uint8_t usb_reply&#91;12&#93;;<br />uchar usbFunctionSetup(uchar data&#91;8&#93;) {<br />   switch (data&#91;1&#93;) {<br />      case CMD_POLL:    <br />            usbMsgPtr = usb_reply;<br />            return sizeof(usb_reply);<br /></code></pre></div><br />Using this method there's no way to be sure that an &quot;important&quot; usb_reply[] is sent, because the main() { } is running as fast as possible always updating usb_reply[]. A solution would be to use usbSetInterrupt() but only 8 bytes can be passed in one call, so i would need 2 calls. Instead by checking if an important usb_reply[] need to be send and checking if it's sent, it's possible to pass 12 bytes in 1 CMD_POLL.<br /><br />Does it make any sense?<br />Cheers,<br />Patrick<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1494">psc</a> — Fri Apr 24, 2009 6:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2009-04-24T11:12:27+02:00</updated>

		<published>2009-04-24T11:12:27+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9047#p9047</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9047#p9047"/>
		<title type="html"><![CDATA[Re: alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9047#p9047"><![CDATA[
I'm not sure I understand what you want to do. Do you send a CMD_POLL setup request after receipt of each interrupt packet from the host to acknowledge the receipt? And why should this be faster or better than using usbInterruptIsReady()?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Apr 24, 2009 11:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psc]]></name></author>
		<updated>2009-04-22T16:42:05+02:00</updated>

		<published>2009-04-22T16:42:05+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9025#p9025</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9025#p9025"/>
		<title type="html"><![CDATA[Re: alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9025#p9025"><![CDATA[
Finally i've decided to use Custom class device. I am not sure about the following code, but i am sharing it (maybe someone will tell me that it's not good). I can send 12 bytes in 8 ms and the speed of main() { } is not affected when i don't care about sending important value, avoiding this: <br /><br /><blockquote class="uncited"><div>In order to keep the &quot;device sends data spontaneously&quot; semantics, you pass interrupt and bulk data by calling usbSetInterrupt() or usbSetInterrupt3() for endpoint 1 and 3 respectively. Up to 8 bytes may be passed in one call. The driver keeps the data in a buffer until it is requested by the host.</div></blockquote><br /><br /><div class="codebox"><p>Code: </p><pre><code>volatile unsigned char sent = 0;<br /><br />uchar usbFunctionSetup(uchar data&#91;8&#93;)<br />{<br />   switch (data&#91;1&#93;) {      <br />      case CMD_POLL:    <br />         usbMsgPtr = usb_reply;<br />         sent = 1;<br />         return sizeof(usb_reply);<br />         break;<br />...<br /><br />int main(void)<br />{<br />   wdt_enable(WDTO_1S);<br />   hardwareInit();<br />   usbInit();<br />   sei();<br /><br />   uchar send = 0;<br /><br />   while(1) {<br />      wdt_reset();<br />      usbPoll();<br /><br />      //send important value<br />      if(bit_is_clear(PIND, 5)) {<br />         usb_reply&#91;0&#93; = 33;<br />         send = 1;<br />      }<br /><br />      //send NOT important value<br />      usb_reply&#91;1&#93; = 66;<br /><br />      //hack to avoid using usbInterruptIsReady()<br />      if(send == 1) {<br />         while(sent == 0) {<br />            wdt_reset();<br />            usbPoll();<br />            if(sent == 1) {<br />               break;<br />            }<br />         }<br />      }<br />      send = sent = 0;<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=1494">psc</a> — Wed Apr 22, 2009 4:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2009-04-22T11:53:49+02:00</updated>

		<published>2009-04-22T11:53:49+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9017#p9017</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9017#p9017"/>
		<title type="html"><![CDATA[Re: alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=9017#p9017"><![CDATA[
I doubt that you can make this faster with this descriptor size...<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Wed Apr 22, 2009 11:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psc]]></name></author>
		<updated>2009-04-20T04:29:04+02:00</updated>

		<published>2009-04-20T04:29:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=2675&amp;p=8983#p8983</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=8983#p8983"/>
		<title type="html"><![CDATA[alternative to usbSetInterrupt with HID]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=2675&amp;p=8983#p8983"><![CDATA[
Hi everyone,<br /><br />I hope someone will take the time to enlight me. I want to avoid installation of a driver, so i am using HID (joystick). I am running V-USB on an atmega164p @ 20 mhz. My reportBuffer is 12 bytes. This is how i send the report:<br /><br /><div class="codebox"><p>Code: </p><pre><code>while (!usbInterruptIsReady()) {<br />   wdt_reset();<br />   usbPoll();<br />}<br />usbSetInterrupt(reportBuffer, 8);<br />while (!usbInterruptIsReady()) {<br />   wdt_reset();<br />   usbPoll();<br />}<br />usbSetInterrupt(secondreportBuffer, 8);<br /></code></pre></div><br /><br />This takes 16ms to finish. It's a bit too long, i would like to achieve the lowest latency possible. Since bulk endpoints are not allowed for low speed devices and the fact that i am using the HID protocol and not libusb, what are my choices? I was reading about usbFunctionRead(), would it work and be faster?<br /><br />Thank you very much for any information,<br />Patrick<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1494">psc</a> — Mon Apr 20, 2009 4:29 am</p><hr />
]]></content>
	</entry>
	</feed>
