10 Aug 2006 22:48
help req: Texas Instruments device and Python libUSB bulkread problem...
Ray Schumacher <rays <at> blue-cove.com>
2006-08-10 20:48:45 GMT
2006-08-10 20:48:45 GMT
I am "randomly" getting an extra 2 bytes in my bulkRead()
returns, and need to determine if it is the Ti device or my
Python-wrapped libusb. The Labview demo app that came with the device
does not seem to have an issue.
I've been running SniffUSB ( http://benoit.papillault.free.fr/usbsnoop/doc.php.en) and a wxPython data capture app simultaneously a Ti asd1271 USB A/D device to double-check the data stream, so, the bytes also show up in the raw USb data stream - but why...
The Python app uses calls to libusb to do bulkRead()s on the endpoint.
ans = ()
ans += deviceHandle.bulkRead(0x81, numBytes, 100)
in a while() loop.
The CSV data is a dump of the raw ans (a tuple-list)
In the data below, the "last good data" is
hex "00 06 c9"
int 0 6 201
and the 2 problem bytes are
hex "06 df"
int 0 223
at the beginning of URB 436, the same both in my CSV dump (ints) and the corresponding sniffer log file sections (hex).
Upon checking the log for prior and post data around the extra bytes, it appears that the data surrounding is not repeated elsewhere, so it is not a truncated re-send phenomenon, as in an error etc.
Note that the 2 bytes are always at the start of a bulk return, and on a block boundary (the A/D has a block size of 128 samples - 768 bytes - 0x300 hex). First at urb 436, and, the beginning of urb 578 also has an "extra' 0700.
urb 436 is after a request for 0x600 bytes rather than the usual 0x300, and the first return returned zero bytes.
578 is a short transfer, 40 bytes, also the only one.
They are not regularly occuring...
The error always occurs wherever there are 2 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER in a row with out intervening control-index type transfers.
(BTW, The attached snoop.py file by Dr. Alex Perry nicely condenses usbsnoop logs to one line per urb.)
CSV data dump from capture app:
15230 -0.00017 -0.000211 -0.000001 -0.000001 0 5 148 0 6 235
15231 -0.000167 -0.000207 0.000003 0.000004 0 5 125 0 6 201
15232 -0.05368 -0.044373 -0.053513 -0.044165 6 223 0 5 174 0
15233 -0.052917 -0.042938 0.000763 0.001434 6 198 0 5 127 0
usbsnoop.log:
000002f0: 88 00 06 e1 00 05 94 00 06 eb 00 05 7d 00 06 c9
UrbLink = 00000000
[14937 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14937 ms] >>> URB 433 going down >>>
-- URB_FUNCTION_VENDOR_INTERFACE:
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000001
TransferBuffer = 86540978
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000000
Value = 00000000
Index = 00000001
[14938 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=86684a88, IRQL=2
[14938 ms] <<< URB 433 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 864865a8
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000001
TransferBuffer = 86540978
TransferBufferMDL = 8676cc08
00000000: 04
UrbLink = 00000000
SetupPacket =
00000000: c1 00 00 00 01 00 01 00
[14938 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14938 ms] >>> URB 434 going down >>>
-- URB_FUNCTION_VENDOR_INTERFACE:
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 86540978
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000007
Value = 00000000
Index = 00000001
[14939 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=866849d8, IRQL=2
[14939 ms] <<< URB 434 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 864865a8
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 86540978
TransferBufferMDL = 8676cc08
00000000: 00 00 00 02
UrbLink = 00000000
SetupPacket =
00000000: c1 07 00 00 01 00 04 00
[14939 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14939 ms] >>> URB 435 going down >>>
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14940 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=8661ad58, IRQL=2
[14940 ms] <<< URB 435 coming back <<<
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000000
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14940 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14940 ms] >>> URB 436 going down >>>
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14942 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=8653fb88, IRQL=2
[14942 ms] <<< URB 436 coming back <<<
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
00000000: 06 df 00 05 ae 00 06 c6 00 05 7f 00 06 df 00 05
I'd appreciate _any_ suggestions of how to further debug this!
Ray S.
I've been running SniffUSB ( http://benoit.papillault.free.fr/usbsnoop/doc.php.en) and a wxPython data capture app simultaneously a Ti asd1271 USB A/D device to double-check the data stream, so, the bytes also show up in the raw USb data stream - but why...
The Python app uses calls to libusb to do bulkRead()s on the endpoint.
ans = ()
ans += deviceHandle.bulkRead(0x81, numBytes, 100)
in a while() loop.
The CSV data is a dump of the raw ans (a tuple-list)
In the data below, the "last good data" is
hex "00 06 c9"
int 0 6 201
and the 2 problem bytes are
hex "06 df"
int 0 223
at the beginning of URB 436, the same both in my CSV dump (ints) and the corresponding sniffer log file sections (hex).
Upon checking the log for prior and post data around the extra bytes, it appears that the data surrounding is not repeated elsewhere, so it is not a truncated re-send phenomenon, as in an error etc.
Note that the 2 bytes are always at the start of a bulk return, and on a block boundary (the A/D has a block size of 128 samples - 768 bytes - 0x300 hex). First at urb 436, and, the beginning of urb 578 also has an "extra' 0700.
urb 436 is after a request for 0x600 bytes rather than the usual 0x300, and the first return returned zero bytes.
578 is a short transfer, 40 bytes, also the only one.
They are not regularly occuring...
The error always occurs wherever there are 2 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER in a row with out intervening control-index type transfers.
(BTW, The attached snoop.py file by Dr. Alex Perry nicely condenses usbsnoop logs to one line per urb.)
CSV data dump from capture app:
15230 -0.00017 -0.000211 -0.000001 -0.000001 0 5 148 0 6 235
15231 -0.000167 -0.000207 0.000003 0.000004 0 5 125 0 6 201
15232 -0.05368 -0.044373 -0.053513 -0.044165 6 223 0 5 174 0
15233 -0.052917 -0.042938 0.000763 0.001434 6 198 0 5 127 0
usbsnoop.log:
000002f0: 88 00 06 e1 00 05 94 00 06 eb 00 05 7d 00 06 c9
UrbLink = 00000000
[14937 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14937 ms] >>> URB 433 going down >>>
-- URB_FUNCTION_VENDOR_INTERFACE:
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000001
TransferBuffer = 86540978
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000000
Value = 00000000
Index = 00000001
[14938 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=86684a88, IRQL=2
[14938 ms] <<< URB 433 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 864865a8
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000001
TransferBuffer = 86540978
TransferBufferMDL = 8676cc08
00000000: 04
UrbLink = 00000000
SetupPacket =
00000000: c1 00 00 00 01 00 01 00
[14938 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14938 ms] >>> URB 434 going down >>>
-- URB_FUNCTION_VENDOR_INTERFACE:
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 86540978
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000007
Value = 00000000
Index = 00000001
[14939 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=866849d8, IRQL=2
[14939 ms] <<< URB 434 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 864865a8
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 86540978
TransferBufferMDL = 8676cc08
00000000: 00 00 00 02
UrbLink = 00000000
SetupPacket =
00000000: c1 07 00 00 01 00 04 00
[14939 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14939 ms] >>> URB 435 going down >>>
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14940 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=8661ad58, IRQL=2
[14940 ms] <<< URB 435 coming back <<<
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000000
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14940 ms] UsbSnoop - MyDispatchInternalIOCTL(f79b4e80) : fdo=86598a68, Irp=866fd890, IRQL=0
[14940 ms] >>> URB 436 going down >>>
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
UrbLink = 00000000
[14942 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b4db0) : fido=00000000, Irp=866fd890, Context=8653fb88, IRQL=2
[14942 ms] <<< URB 436 coming back <<<
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 8659bbdc [endpoint 0x00000081]
TransferFlags = 00000003 (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000600
TransferBuffer = 00000000
TransferBufferMDL = 8676cc08
00000000: 06 df 00 05 ae 00 06 c6 00 05 7f 00 06 df 00 05
I'd appreciate _any_ suggestions of how to further debug this!
Ray S.
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Libusb-win32-devel mailing list Libusb-win32-devel <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
RSS Feed