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

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

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

		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2017-07-21T16:12:18+02:00</updated>

		<published>2017-07-21T16:12:18+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32663#p32663</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32663#p32663"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32663#p32663"><![CDATA[
All of my issues were related to the global int flag. and this <a href="https://forums.obdev.at/viewtopic.php?f=8&amp;t=10981" class="postlink">https://forums.obdev.at/viewtopic.php?f=8&amp;t=10981</a>I was using a combination of atomic and cli to control int's. Now I just start and stop my INT0 directly and only, this allows use of interrupts to work fine for my code that needs it. I just make sure to stay within the usb timing window for v-usb.<br /><br />So my original thinning was that I had to make the USB deal with the interruptions, correctly.  This still should have worked but fixing the source of the problem did a much better job.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Fri Jul 21, 2017 4:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[declan smith]]></name></author>
		<updated>2017-06-28T15:54:18+02:00</updated>

		<published>2017-06-28T15:54:18+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32438#p32438</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32438#p32438"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32438#p32438"><![CDATA[
For more certain answer, use VUSB example and test your API.<br />If no problem exist then you should remake your code.<br /><br />You noted that you do something about USB interrupt, who knows that involved.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7773">declan smith</a> — Wed Jun 28, 2017 3:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[declan smith]]></name></author>
		<updated>2017-06-28T15:46:54+02:00</updated>

		<published>2017-06-28T15:46:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32436#p32436</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32436#p32436"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32436#p32436"><![CDATA[
<blockquote><div><cite>ulao wrote:</cite>For <span style="color: #FF0000">in</span> I need to added the few bytes for address and what not (132) but its always the same.</div></blockquote><br />That's what made me wrote the statement.<br /><br /><blockquote><div><cite>ulao wrote:</cite>By interface do you mean pipes, or collections?</div></blockquote><br />Collections<br /><br /><blockquote><div><cite>ulao wrote:</cite>I can certainly do that, just didn't see the need.</div></blockquote><br />When you do that, you don't have to worry about changing report size in your device as your API will always match your device report size.<br />But you know what best for you.<br /><br /><blockquote><div><cite>ulao wrote:</cite>I will still need a 128 byte payload to work so the concentration of my problem is to that.</div></blockquote><br />Set your in/out the same payload size 128 and don't forget 128 bytes payload means 129 report size.<br />And see if your problem still exist.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7773">declan smith</a> — Wed Jun 28, 2017 3:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2017-06-28T14:48:19+02:00</updated>

		<published>2017-06-28T14:48:19+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32435#p32435</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32435#p32435"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32435#p32435"><![CDATA[
<blockquote class="uncited"><div>You should do 132 bytes for report out not 128.</div></blockquote><br /><br /><blockquote class="uncited"><div>What I do is always use 128, in or out. <strong class="text-strong">For in I need to added the few bytes for address and what not (132) but its always the same.</strong> <br /></div></blockquote><br /><br />That's what I said, you just cut off the part of my text that said 132 <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=";)" title="Wink" /><br /><br /><blockquote class="uncited"><div>In your API while you connect to your device, you can get the &quot;in/out report size&quot; value and <br />use it in your get/set function, do not harcoded those size.</div></blockquote> - I can certainly do that, just didn't see the need. Do you think that is the issue in some way. I will still need a 128 byte payload to work so the concentration of my problem is to that. I need to somehow figure out how to reliably get 128 bytes transferred. Although I do see where your points come in, I fail to see how they are causing my issue. The example report descriptor came from v-usb, its not my design. By interface do you mean pipes, or collections?<br /><br />here is my pipe set up<br /><div class="codebox"><p>Code: </p><pre><code>char usbDescriptorConfiguration&#91;&#93; = { 0 }; // dummy <br />static char my_usbDescriptorConfiguration&#91;&#93; = {    /* USB configuration descriptor */ <br />     9,          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ <br />    USBDESCR_CONFIG,    /* descriptor type */ <br />    18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + /*7 * USB_CFG_HAVE_INTRIN_ENDPOINT3*/ + 7 + 9, 0, <br />                /* total length of data returned (including inlined descriptors) */ <br />    1,          /* number of interfaces in this configuration */ <br />    1,          /* index of this configuration */ <br />    0,          /* configuration name string index */ <br />    USB_CFG_IS_SELF_POWERED,  /* attributes */ <br /><br />    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */ <br />/* interface descriptor follows inline: */ <br />    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */ <br />    USBDESCR_INTERFACE, /* descriptor type */ <br />    0,          /* index of this interface */ <br />    0,          /* alternate setting for this interface */ <br />    1 + USB_CFG_HAVE_INTRIN_ENDPOINT ,//+ USB_CFG_HAVE_INTRIN_ENDPOINT3,   /* endpoints excl 0: number of endpoint descriptors to follow */ <br />    USB_CFG_INTERFACE_CLASS, <br />    USB_CFG_INTERFACE_SUBCLASS, <br />    USB_CFG_INTERFACE_PROTOCOL, <br />    0,          /* string index for interface */ <br /><br />    9,          /* sizeof(usbDescrHID): length of descriptor in bytes */ <br />    USBDESCR_HID,   /* descriptor type: HID */ <br />    0x10, 0x01, /* BCD representation of HID version */ <br />    0x00,       /* target country code */ <br />    0x01,       /* number of HID Report (or other HID class) Descriptor infos to follow */ <br />    0x22,       /* descriptor type: report */ <br />    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 5,  /* total length of report descriptor */// <br /><br />    7,          /* sizeof(usbDescrEndpoint) */ <br />    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */ <br />    0x81,       // bulk IN endpoint number 1 <br />    0x03,       /* attrib: Interrupt endpoint */ <br />    8, 0,       /* maximum packet size */ <br />    0x08, /* in ms*/ <br /><br />//the output. <br /><br />    7,          // sizeof(usbDescrEndpoint) <br />    5,  // descriptor type = endpoint <br />    0x01,        // out endpoint number 2 <br />    0x03,       // attrib: Interrupt endpoint <br />    8, 0,       // maximum packet size <br />    0x08, // in ms <br />     <br />}; <br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Wed Jun 28, 2017 2:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[declan smith]]></name></author>
		<updated>2017-06-28T02:21:37+02:00</updated>

		<published>2017-06-28T02:21:37+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32432#p32432</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32432#p32432"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32432#p32432"><![CDATA[
From your descriptor, your report size in is 128 and out is 132. <br /><br /><blockquote><div><cite>ulao wrote:</cite>What I do is always use 128, in or out</div></blockquote><br /><br />You should do 132 bytes for report out not 128.<br /><br />If you want to have 2 report size sistem then use 2 interface setup not 1.<br />In your usbFunctionSetup you can split those 2 interface using your report ID.<br />It's much easier since you can do both get/set in both size.<br /><br />In your API while you connect to your device, you can get the &quot;in/out report size&quot;  value and <br />use it in your get/set function, do not harcoded those size.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7773">declan smith</a> — Wed Jun 28, 2017 2:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2017-06-27T15:51:30+02:00</updated>

		<published>2017-06-27T15:51:30+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32428#p32428</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32428#p32428"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32428#p32428"><![CDATA[
here is the section for my send/recv.<br /><br /><div class="codebox"><p>Code: </p><pre><code>0xa1, 0x01,                    // COLLECTION (Application)<br />    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)<br />    0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)<br />    0x75, 0x08,                    //   REPORT_SIZE (8)<br /><br />    0x85, 0x11,                    //   REPORT_ID (17)<br />    0x95, 0x79,                    //   REPORT_COUNT (127) -- the max<br />    0x09, 0x00,                    //   USAGE (Undefined)<br />    0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)<br /><br />    0x85, 0x12,                    //   REPORT_ID (18)<br />    0x95, 0x83,                    //   REPORT_COUNT (131) -- the max<br />    0x09, 0x00,                    //   USAGE (Undefined)<br />    0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)<br />    0xc0,                           // END_COLLECTION</code></pre></div><br /><br /><br />Why would  the size change randomly? What  I do is always use 128, in or out. For in I need to added the few bytes for address and what not (132) but its always the same. Since this is random, I must be getting a pid stall do to some of the data in the 128  bytes are getting dropped. Otherwise that could never be a mismatch.<br /><br /> I have since switch to another api for my feature request and it does the same thing. Guessing I need to dig deeper here to find the issue?<br /><br />When I stared this I had two issue, one was memory move issues with cli/sei I since fixed with ATOMIC. Now my second issues is the random dropping of data and PID stalls. To fix this I just keep sending till its right. Do to the randomness it eventual gives in but this is a horrible fix.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Tue Jun 27, 2017 3:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[declan smith]]></name></author>
		<updated>2017-06-13T15:01:08+02:00</updated>

		<published>2017-06-13T15:01:08+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32371#p32371</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32371#p32371"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32371#p32371"><![CDATA[
You haven't provide your device descriptor.<br />It's difficult to only look at your few code to give the right answer.<br /><br />If you got PID Stall but not always, then your report size was incorrect or your host sofware use different report size.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7773">declan smith</a> — Tue Jun 13, 2017 3:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2017-05-30T03:52:34+02:00</updated>

		<published>2017-05-30T03:52:34+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32318#p32318</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32318#p32318"/>
		<title type="html"><![CDATA[Re: data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32318#p32318"><![CDATA[
I did sum sniffing and its a pid stall. <br /><br /><blockquote class="uncited"><div>When a device receives a request that is undefined, is inappropriate given the current setting or state of the device, or uses values that are inappropriate for the particular request, then a Request Error exists. The device handles a Request Error by returning a STALL PID to the next DATA or STATUS stage, preferably at the next DATA stage transaction.</div></blockquote><br /><br />Since it's random and not every send that errors, &quot;a request that is undefined&quot; and &quot;values that are inappropriate for the particular request&quot; thus my error must be &quot;inappropriate given the current setting or state of the device&quot;However I'm still uncertain what &quot;state&quot; my device is in that causes this.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Tue May 30, 2017 3:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2017-05-26T03:42:58+02:00</updated>

		<published>2017-05-26T03:42:58+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32303#p32303</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32303#p32303"/>
		<title type="html"><![CDATA[data send getting interupted.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10842&amp;p=32303#p32303"><![CDATA[
I'm trying to send data to my device via the usb.dll usbSetReport function. I set up my usbFunctionWrite to watch for my report ID then a command on byte 2. I return 0 to tell the driver to expect more (bytesRemaining). This most of the time works but some times dies. When it dies it just stop and does not loop any further.  I'm not sure what I need to suppress so that the driver can get all the data in one shot.<br /><br /> Here is an example of how I do it.<br /><div class="codebox"><p>Code: </p><pre><code><br />uchar usbFunctionWrite(uchar *data, uchar len) <br />{ <br />    char j=0; //loop <br />      <br />    if(needMoreThen8Data) <br />    { <br />      if(needMoreThen8Data==0x24) <br />      {<br />         for (unsigned char i=currentAddress;i&lt;currentAddress+8;i++) <br />            {lcd_data&#91;i&#93; = data&#91;j&#93;; j++;}<br />         _lcdNeedsWrite = 1;             <br />      }<br />            <br />            <br /><br />        currentAddress += len; <br />        bytesRemaining -= len; <br />        if(bytesRemaining == 0) {needMoreThen8Data=0;return 1;}//finished <br />        return 0; <br />    } <br /><br />    if ( data&#91;0&#93; == 18) <br />    {                 <br />        if (data&#91;1&#93;== 0) //this means to set. <br />        { <br />         if (data&#91;2&#93;== 0x24) <br />         {     <br />         // lcd <br />            bytesRemaining = 116;//120 + this byte. <br />            needMoreThen8Data=0x24;//set flag <br />            currentAddress = 4;//can only load 4 in here. <br />            for (char i=0;i&lt;4;i++) lcd_data&#91;i&#93; = data&#91;i+4&#93;;<br />            return 0;       <br />         } <br />      }<br />        else //must be a get command from setreport. <br />        { <br />        } <br />             <br />    }     <br />}<br />                    </code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Fri May 26, 2017 3:42 am</p><hr />
]]></content>
	</entry>
	</feed>
