[Libusbx-devel] Isochronous packets request result in 8byte garbage at the end of accumulated packets

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Libusbx-devel] Isochronous packets request result in 8byte garbage at the end of accumulated packets

Kuldeep Singh Dhaka
Howdy guys,
Im facing a weird problem.
i have a ST uC (FS usb) that send data of ADC (12 bit) at 176Kilo samples at bInterval=1; (2bytes for 1 sample)
ie 352byte isochronous endpoint requested every 1ms

when i request 1000 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of the 999th packet (assuming packet index start from 0).
when i request 500 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 499th packet.
when i request 100 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 99th packet.
when i request 10 packets (each of 352 bytes) i received 8byte byte garbage value (mostly 0x00 | non-zero on offset 1 byte of garbage start) at the end of 9th packet. (non-zero garbage value position is 352 - 8 + 1).

since, the garbage position shits as number of packets variate, so i can assume that the device is successfully sending each packet.
(and the packet count also not known to device, it very unlikely that this will be related to device).
(even if the problem is in device, the problem should occur in each packet or some multiple version, why every-time error position is similar)

i can see plotting bumps, or 4 samples are garbage after the accumulated packets are plotted. (qcustomplot + qt + libusbx)
im reading sine wave using the ADC so the problem can be seen visually.
plotting on a 10second time-line, request 1000 packets in one callback (1second data), i see 10 points inconsistent, (and after zooming to any of the point, i can see that the point is made up of 4 samples that are always garbage).

for 1000 packets (and 10second timeline) i see 10 inconsistent points (all 0V)
for 100 packets (and 10second timeline) i see 50 inconsistent points (all 0V),
for 10 packets (and 10 second timeline) i see 100 * 10 inconsistent points (first is usually 40 volts (max voltage is 3V), and all others are 0V)

plotting approch: start plotting from 0th position, and when reach the end of memory, again start plotting from 0th position, this is how i was able detect that the problem (that it is at the end of accumulated packets of one callback). (garbage point are always at constant position) 

another test:
i wrote pre-defined bytes (also that would never be send by device) to the allocated buffer buffer, before submiting the iso packets request, and after the callback, the memory was garbage (last 8byte were not equal to the pre-defined bytes). so the memory was actually being incorrectly written written by device, or kernel or libusb.

but since based on the assumption the problem is not from device, problem should be kernel or libusb.

[kuldeep@localhost ~]$ uname -a
Linux localhost.localdomain 3.13.11-100.fc19.x86_64 #1 SMP Wed Apr 23 20:10:57 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[kuldeep@localhost ~]$ yum info libusbx
Loaded plugins: auto-update-debuginfo, langpacks
Installed Packages
Name        : libusbx
Arch        : i686
Version     : 1.0.16
Release     : 3.fc19
Size        : 127 k
Repo        : installed
From repo   : updates
..... bla bla .....
Name        : libusbx
Arch        : x86_64
Version     : 1.0.16
Release     : 3.fc19
Size        : 128 k
Repo        : installed
From repo   : updates
.... bla bla ....

Hope anyone understand/visualize this, and help me can rectify the problem.

--
Kuldeep Singh Dhaka
+91-8791676237
Programmer, Open Source, Embedded System, Entrepreneur, System Administrator, Animal Lover, Web Developer, Learner.
Bitcoins Accepted.

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Isochronous packets request result in 8byte garbage at the end of accumulated packets

Tim Roberts
Kuldeep Singh Dhaka wrote:

Im facing a weird problem.
i have a ST uC (FS usb) that send data of ADC (12 bit) at 176Kilo samples at bInterval=1; (2bytes for 1 sample)
ie 352byte isochronous endpoint requested every 1ms

when i request 1000 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of the 999th packet (assuming packet index start from 0).
when i request 500 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 499th packet.
when i request 100 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 99th packet.
when i request 10 packets (each of 352 bytes) i received 8byte byte garbage value (mostly 0x00 | non-zero on offset 1 byte of garbage start) at the end of 9th packet. (non-zero garbage value position is 352 - 8 + 1).

Can you show us your code?  It's difficult to imagine how anything below your application could cause this.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Isochronous packets request result in 8byte garbage at the end of accumulated packets

Kuldeep Singh Dhaka
Finally got the problem solved, (sorry for the chaos.)
problem was i incorrectly used "libusb_control_transfer_get_data" instead of transfer->buffer and that was contributing to the +8.
instead of sending the whole source (ie WIP, untested mostly), when i wrote a new program (to share), it didnt showed the error, and finally found the differential. :).
Thank You.

On 06/03/2014 12:08 AM, Tim Roberts wrote:
Kuldeep Singh Dhaka wrote:

Im facing a weird problem.
i have a ST uC (FS usb) that send data of ADC (12 bit) at 176Kilo samples at bInterval=1; (2bytes for 1 sample)
ie 352byte isochronous endpoint requested every 1ms

when i request 1000 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of the 999th packet (assuming packet index start from 0).
when i request 500 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 499th packet.
when i request 100 packets (each of 352 bytes), i received 8byte garbage value (mostly 0x00) at the end of 99th packet.
when i request 10 packets (each of 352 bytes) i received 8byte byte garbage value (mostly 0x00 | non-zero on offset 1 byte of garbage start) at the end of 9th packet. (non-zero garbage value position is 352 - 8 + 1).

Can you show us your code?  It's difficult to imagine how anything below your application could cause this.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech


_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


--
Kuldeep Singh Dhaka
+91-8791676237
Programmer, Open Source, Embedded System, Entrepreneur, System Administrator, Animal Lover, Web Developer, Learner.
Bitcoins Accepted.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Loading...