USB communication seems to bug out when powering the ZTurn with a +5/-3V adapter. Sometimes the communication is OK, sometimes not. Which adapter works sometimes feels like random. There are no issues when powering via a lab power supply or using the MicroZed.
The main symptom is power supply communication resulting in the following error and then taking almost a minute for the program to finish.
terminate called after throwing an instance of 'std::runtime_error'
what(): TextSerialCom: Read timeout reached without seeing termination.
The error seen in the kernel log is:
ftdi_sio ttyUSB0: Unable to read latency timer: -110
ftdi_sio ttyUSB0: Unable to write latency timer: -110
Sometimes the kernel log contains the following:
ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
Using wireshark to spy on USB traffic. The tshark
command provides an terminal UI.
The usbmon
module needs to be manually loaded/
modprobe usbmon
To get list of available devices:
root@pbv3_mass_test_adapter:~# tshark -D
Running as user "root" and group "root". This could be dangerous.
1. eth0
2. lo (Loopback)
3. any
4. bluetooth-monitor
5. can0
6. sit0
7. usbmon0
8. usbmon1
9. dpauxmon (DisplayPort AUX channel monitor capture)
10. udpdump (UDP Listener remote capture)
To spy on traffic, use tshark -i 7
. The 7
is the usbmon interface (usbmon0
, determined by trail and error) corresponding to the USB port.
Example dump of spying on measure current via GPIB.
root@pbv3_mass_test_adapter:~# tshark -i 7
Running as user "root" and group "root". This could be dangerous.
Capturing on 'usbmon0'
1 0.000000 host ? 1.2.0 USB 64 URB_CONTROL out
2 0.001478 1.2.0 ? host USB 64 URB_CONTROL out
3 0.001526 host ? 1.2.0 USB 64 URB_CONTROL out
4 0.002464 1.2.0 ? host USB 64 URB_CONTROL out
5 0.002507 host ? 1.2.0 USB 64 URB_CONTROL out
6 0.003463 1.2.0 ? host USB 64 URB_CONTROL out
7 0.003500 host ? 1.2.0 USB 64 URB_CONTROL out
8 0.004462 1.2.0 ? host USB 64 URB_CONTROL out
9 0.004499 host ? 1.2.1 USB 64 URB_BULK in
10 0.004518 host ? 1.2.1 USB 64 URB_BULK in
11 0.004532 host ? 1.2.0 USB 64 URB_CONTROL out
12 0.005465 1.2.0 ? host USB 64 URB_CONTROL out
13 0.009003 host ? 1.2.0 USB 64 URB_CONTROL out
14 0.009470 1.2.0 ? host USB 64 URB_CONTROL out
15 0.009515 host ? 1.2.0 USB 64 URB_CONTROL out
16 0.010464 1.2.0 ? host USB 64 URB_CONTROL out
17 0.010891 host ? 1.2.2 USB 73 URB_BULK out
18 0.011370 host ? 1.2.2 USB 73 URB_BULK out
19 0.011514 1.2.2 ? host USB 64 URB_BULK out
20 0.011861 host ? 1.2.2 USB 70 URB_BULK out
21 0.012473 1.2.2 ? host USB 64 URB_BULK out
22 0.012496 host ? 1.2.2 USB 75 URB_BULK out
23 0.012523 1.2.2 ? host USB 64 URB_BULK out
24 0.012530 1.2.1 ? host USB 66 URB_BULK in
25 0.012536 host ? 1.2.1 USB 64 URB_BULK in
26 0.013463 1.2.2 ? host USB 64 URB_BULK out
27 0.028466 1.2.1 ? host USB 124 URB_BULK in
28 0.028502 host ? 1.2.1 USB 64 URB_BULK in
29 0.029361 host ? 1.2.2 USB 73 URB_BULK out
30 0.029791 host ? 1.2.2 USB 70 URB_BULK out
31 0.031468 1.2.2 ? host USB 64 URB_BULK out
32 0.031492 host ? 1.2.2 USB 75 URB_BULK out
33 0.031519 1.2.2 ? host USB 64 URB_BULK out
34 0.032462 1.2.2 ? host USB 64 URB_BULK out
35 0.044464 1.2.1 ? host USB 124 URB_BULK in
36 0.044498 host ? 1.2.1 USB 64 URB_BULK in
37 0.047238 host ? 1.2.2 USB 73 URB_BULK out
38 0.047479 1.2.2 ? host USB 64 URB_BULK out
39 0.047501 host ? 1.2.2 USB 76 URB_BULK out
40 0.048143 host ? 1.2.2 USB 73 URB_BULK out
41 0.048474 1.2.2 ? host USB 64 URB_BULK out
42 0.048505 1.2.2 ? host USB 64 URB_BULK out
43 0.048893 host ? 1.2.2 USB 75 URB_BULK out
44 0.049293 host ? 1.2.2 USB 75 URB_BULK out
45 0.049481 1.2.2 ? host USB 64 URB_BULK out
46 0.049507 1.2.2 ? host USB 64 URB_BULK out
47 0.060465 1.2.1 ? host USB 66 URB_BULK in
48 0.060483 host ? 1.2.1 USB 64 URB_BULK in
49 0.076462 1.2.1 ? host USB 66 URB_BULK in
50 0.076480 host ? 1.2.1 USB 64 URB_BULK in
51 0.092464 1.2.1 ? host USB 66 URB_BULK in
52 0.092482 host ? 1.2.1 USB 64 URB_BULK in
53 0.108466 1.2.1 ? host USB 66 URB_BULK in
54 0.108483 host ? 1.2.1 USB 64 URB_BULK in
55 0.124459 1.2.1 ? host USB 66 URB_BULK in
56 0.124474 host ? 1.2.1 USB 64 URB_BULK in
57 0.140457 1.2.1 ? host USB 66 URB_BULK in
58 0.140473 host ? 1.2.1 USB 64 URB_BULK in
59 0.156463 1.2.1 ? host USB 66 URB_BULK in
60 0.156479 host ? 1.2.1 USB 64 URB_BULK in
61 0.172461 1.2.1 ? host USB 66 URB_BULK in
62 0.172476 host ? 1.2.1 USB 64 URB_BULK in
63 0.188456 1.2.1 ? host USB 66 URB_BULK in
64 0.188472 host ? 1.2.1 USB 64 URB_BULK in
65 0.204460 1.2.1 ? host USB 66 URB_BULK in
66 0.204475 host ? 1.2.1 USB 64 URB_BULK in
67 0.220460 1.2.1 ? host USB 66 URB_BULK in
68 0.220475 host ? 1.2.1 USB 64 URB_BULK in
69 0.236460 1.2.1 ? host USB 66 URB_BULK in
70 0.236475 host ? 1.2.1 USB 64 URB_BULK in
71 0.252458 1.2.1 ? host USB 66 URB_BULK in
72 0.252473 host ? 1.2.1 USB 64 URB_BULK in
73 0.268455 1.2.1 ? host USB 66 URB_BULK in
74 0.268472 host ? 1.2.1 USB 64 URB_BULK in
75 0.284459 1.2.1 ? host USB 66 URB_BULK in
76 0.284474 host ? 1.2.1 USB 64 URB_BULK in
77 0.300454 1.2.1 ? host USB 66 URB_BULK in
78 0.300470 host ? 1.2.1 USB 64 URB_BULK in
79 0.316469 1.2.1 ? host USB 66 URB_BULK in
80 0.316496 host ? 1.2.1 USB 64 URB_BULK in
81 0.332451 1.2.1 ? host USB 66 URB_BULK in
82 0.332469 host ? 1.2.1 USB 64 URB_BULK in
83 0.348456 1.2.1 ? host USB 66 URB_BULK in
84 0.348473 host ? 1.2.1 USB 64 URB_BULK in
85 0.364449 1.2.1 ? host USB 66 URB_BULK in
86 0.364465 host ? 1.2.1 USB 64 URB_BULK in
87 0.380448 1.2.1 ? host USB 70 URB_BULK in
88 0.380481 host ? 1.2.1 USB 64 URB_BULK in
89 0.396453 1.2.1 ? host USB 78 URB_BULK in
90 0.396482 host ? 1.2.1 USB 64 URB_BULK in
91 0.396959 host ? 1.2.0 USB 64 URB_CONTROL in
92 0.397463 1.2.0 ? host USB 66 URB_CONTROL in
93 0.397518 host ? 1.2.0 USB 64 URB_CONTROL out
94 0.398452 1.2.0 ? host USB 64 URB_CONTROL out
95 0.398493 host ? 1.2.0 USB 64 URB_CONTROL out
96 0.399451 1.2.0 ? host USB 64 URB_CONTROL out
97 0.402545 1.2.1 ? host USB 64 URB_BULK in
98 0.404948 1.2.1 ? host USB 64 URB_BULK in
Example dump of spying on echo 1 > /sys/bus/usb-serial/drivers/ftdi_sio/ttyUSB0/latency_timer
(latency set):
root@pbv3_mass_test_adapter:~# tshark -i 7
Running as user "root" and group "root". This could be dangerous.
Capturing on 'usbmon0'
1 0.000000 host ? 1.2.0 USB 64 URB_CONTROL out
2 0.001426 1.2.0 ? host USB 64 URB_CONTROL out
Detailed:
root@pbv3_mass_test_adapter:~# tshark -i 7 -P -V -x
Running as user "root" and group "root". This could be dangerous.
Capturing on 'usbmon0'
1 0.000000 host ? 1.2.0 USB 64 URB_CONTROL out
Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon0, id 0
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Aug 23, 2021 18:36:23.337111000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1629743783.337111000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 64 bytes (512 bits)
Capture Length: 64 bytes (512 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: host]
[Destination: 1.2.0]
URB id: 0x00000000c20dc680
URB type: URB_SUBMIT ('S')
URB transfer type: URB_CONTROL (0x02)
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.... 0000 = Endpoint number: 0
Device: 2
URB bus id: 1
Device setup request: relevant (0)
Data: present (0)
URB sec: 1629743783
URB usec: 337111
URB status: Operation now in progress (-EINPROGRESS) (-115)
URB length [bytes]: 0
Data length [bytes]: 0
Interval: 0
Start frame: 0
Copy of Transfer Flags: 0x00000000
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .0.. = No transfer DMA map: False
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..0. .... .... = Dir IN: False
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
[bInterfaceClass: Unknown (0xffff)]
Setup Data
bmRequestType: 0x40
0... .... = Direction: Host-to-device
.10. .... = Type: Vendor (0x2)
...0 0000 = Recipient: Device (0x00)
bRequest: 9
wValue: 0x0001
wIndex: 0 (0x0000)
wLength: 0
0000 80 c6 0d c2 00 00 00 00 53 02 00 02 01 00 00 00 ........S.......
0010 a7 ea 23 61 00 00 00 00 d7 24 05 00 8d ff ff ff ..#a.....$......
0020 00 00 00 00 00 00 00 00 40 09 01 00 00 00 00 00 ........@.......
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
2 0.001235 1.2.0 ? host USB 64 URB_CONTROL out
Frame 2: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon0, id 0
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Aug 23, 2021 18:36:23.338346000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1629743783.338346000 seconds
[Time delta from previous captured frame: 0.001235000 seconds]
[Time delta from previous displayed frame: 0.001235000 seconds]
[Time since reference or first frame: 0.001235000 seconds]
Frame Number: 2
Frame Length: 64 bytes (512 bits)
Capture Length: 64 bytes (512 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: 1.2.0]
[Destination: host]
URB id: 0x00000000c20dc680
URB type: URB_COMPLETE ('C')
URB transfer type: URB_CONTROL (0x02)
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.... 0000 = Endpoint number: 0
Device: 2
URB bus id: 1
Device setup request: not relevant ('-')
Data: not present ('>')
URB sec: 1629743783
URB usec: 338346
URB status: Success (0)
URB length [bytes]: 0
Data length [bytes]: 0
[Request in: 1]
[Time from request: 0.001235000 seconds]
Unused Setup Header
Interval: 0
Start frame: 0
Copy of Transfer Flags: 0x00000000
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .0.. = No transfer DMA map: False
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..0. .... .... = Dir IN: False
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
[bInterfaceClass: Unknown (0xffff)]
0000 80 c6 0d c2 00 00 00 00 43 02 00 02 01 00 2d 3e ........C.....->
0010 a7 ea 23 61 00 00 00 00 aa 29 05 00 00 00 00 00 ..#a.....)......
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Example of latency set with a "bad" power adapter:
Capturing on 'usbmon0'
1 0.000000 host ? 1.2.0 USB 64 URB_CONTROL out
ftdi_sio ttyUSB0: Unable to write latency timer: -110
2 5.095023 1.2.0 ? host USB 64 URB_CONTROL out
Detailed:
root@pbv3_mass_test_adapter:~# tshark -i 7 -P -V -x
Running as user "root" and group "root". This could be dangerous.
Capturing on 'usbmon0'
1 0.000000 host ? 1.2.0 USB 64 URB_CONTROL out
Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon0, id 0
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Aug 23, 2021 18:40:04.288153000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1629744004.288153000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 64 bytes (512 bits)
Capture Length: 64 bytes (512 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: host]
[Destination: 1.2.0]
URB id: 0x00000000c1e07700
URB type: URB_SUBMIT ('S')
URB transfer type: URB_CONTROL (0x02)
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.... 0000 = Endpoint number: 0
Device: 2
URB bus id: 1
Device setup request: relevant (0)
Data: present (0)
URB sec: 1629744004
URB usec: 288153
URB status: Operation now in progress (-EINPROGRESS) (-115)
URB length [bytes]: 0
Data length [bytes]: 0
Interval: 0
Start frame: 0
Copy of Transfer Flags: 0x00000000
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .0.. = No transfer DMA map: False
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..0. .... .... = Dir IN: False
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
[bInterfaceClass: Unknown (0xffff)]
Setup Data
bmRequestType: 0x40
0... .... = Direction: Host-to-device
.10. .... = Type: Vendor (0x2)
...0 0000 = Recipient: Device (0x00)
bRequest: 9
wValue: 0x0001
wIndex: 0 (0x0000)
wLength: 0
0000 00 77 e0 c1 00 00 00 00 53 02 00 02 01 00 00 00 .w......S.......
0010 84 eb 23 61 00 00 00 00 99 65 04 00 8d ff ff ff ..#a.....e......
0020 00 00 00 00 00 00 00 00 40 09 01 00 00 00 00 00 ........@.......
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
ftdi_sio ttyUSB0: Unable to write latency timer: -110
2 5.054157 1.2.0 ? host USB 64 URB_CONTROL out
Frame 2: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon0, id 0
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Aug 23, 2021 18:40:09.342310000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1629744009.342310000 seconds
[Time delta from previous captured frame: 5.054157000 seconds]
[Time delta from previous displayed frame: 5.054157000 seconds]
[Time since reference or first frame: 5.054157000 seconds]
Frame Number: 2
Frame Length: 64 bytes (512 bits)
Capture Length: 64 bytes (512 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: 1.2.0]
[Destination: host]
URB id: 0x00000000c1e07700
URB type: URB_COMPLETE ('C')
URB transfer type: URB_CONTROL (0x02)
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.... 0000 = Endpoint number: 0
Device: 2
URB bus id: 1
Device setup request: not relevant ('-')
Data: not present ('>')
URB sec: 1629744009
URB usec: 342310
URB status: No such file or directory (-ENOENT) (-2)
URB length [bytes]: 0
Data length [bytes]: 0
[Request in: 1]
[Time from request: 5.054157000 seconds]
Unused Setup Header
Interval: 0
Start frame: 0
Copy of Transfer Flags: 0x00000000
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .0.. = No transfer DMA map: False
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..0. .... .... = Dir IN: False
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
[bInterfaceClass: Unknown (0xffff)]
0000 00 77 e0 c1 00 00 00 00 43 02 00 02 01 00 2d 3e .w......C.....->
0010 89 eb 23 61 00 00 00 00 26 39 05 00 fe ff ff ff ..#a....&9......
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
The only difference between success and failure is the timing and the following line in the returned failed response:
URB status: No such file or directory (-ENOENT) (-2)
Comparison of packet data.
Host to Device
Device to Host response