Kuldeep Singh Dhaka
2014-06-01 10:35:04 UTC
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.
[***@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
[***@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
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.
[***@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
[***@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