]> sigrok.org Git - sigrok-dumps.git/blame - usb/setup/README
st7735: Add dump with unknown command
[sigrok-dumps.git] / usb / setup / README
CommitLineData
d3d48bb0
SB
1-------------------------------------------------------------------------------
2USB device setup (low-speed signalling)
3-------------------------------------------------------------------------------
4
8928a7f9 5This is an example capture of a USB plugin and setup sequence.
d3d48bb0
SB
6
7Plugin and reset signaling (trace walktrough)
8---------------------------------------------
9
10The logic analyzer is connected to the D+ and D- signals of the device. As the
11device ground is not connected to the LA ground, the signal level at the start
12of the trace is arbitrary.
13
14When the cable is plugged in, DM and DP are pulled down by the host side 15k
15pull-down resistors. Next, the power supply level of the device rises and
16the 1.5k pull-up resistor signals the connection of a low speed device.
17
18The host waits for 100ms, according to the attach debounce interval [USB 2.0
19spec, Table 7-14, T_ATTDB] for the connection and device power to become
20stable. At 240ms the host signals a reset (SE) condition for 50ms [USB 2.0
21spec, 7.1.7.5, T_DRSTR].
22
23After the reset, the host issues keep-alives every 1ms (SE0 for 2 bit times),
24to allow the device to recover. 10ms are required, but the Linux kernel waits
25at least 100ms.
26
27At this time, the host knows the port is enabled and the device is in the
28DEFAULT state, e.g. it responds to control requests at address 0. It is now
29possible to request the Device Descriptor.
30
31At 398ms, the GET_DEVICE_DESCRIPTOR request is the first condition decoded by
32the usb_signalling and stacked protocol decoders. After this request, the
33max packet size for the control endpoint is known.
34
35After the request, some buggy devices may be in a bad state (1), thus there
36is a second reset/device recovery cycle.
37
38There follows a sequence of SET_ADDRESS(13) and more GET_DESCRIPTOR requests.
39After the setup, the polling of the INTERRUPT endpoint (EP1) starts.
40
41---
42(1) The stack requests 64 bytes of device descriptor because otherwise some
43devices may return more than requested. Other devices can not cope with this
44request, and thus a reset is needed. If all devices where compliant, a request
45of just 8 bytes should return the wanted bMaxPacketSize of the device.
46
47
48Decoding in PulseView
49---------------------
50
51Add a usb_signalling decoder. Set the signalling to "low-speed", next assign
52DP to "D+" and DM to "D-". The usb_packet and usb_request PDs can be stacked
53on top.
54
55Creating a PCAP (Wireshark) capture
56-----------------------------------
57
581. Convert the trace with sigrok-cli.
59
60 $ sigrok-cli -i usb_reset_and_setup_lowspeed.sr \
61 -P usb_signalling:dp=DP:dm=DM:signalling=low-speed,usb_packet,usb_request \
62 -B usb_request > usb_reset_and_setup_lowspeed.pcap
63
642. View with tshark (wireshark command line tool).
65
66 $ tshark -r usb_reset_and_setup_lowspeed.pcap
67 1 0.000000 host -> 0.0 USB 64 GET DESCRIPTOR Request DEVICE
68 2 0.002258 0.0 -> host USB 82 GET DESCRIPTOR Response DEVICE
69 3 0.154975 host -> 0.0 USB 64 SET ADDRESS Request
70 4 0.155441 0.0 -> host USB 64 SET ADDRESS Response
71 5 0.165960 host -> 13.0 USB 64 GET DESCRIPTOR Request DEVICE
72 6 0.168258 13.0 -> host USB 82 GET DESCRIPTOR Response DEVICE
73 7 0.168287 host -> 13.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
74 8 0.169757 13.0 -> host USB 73 GET DESCRIPTOR Response CONFIGURATION
75 9 0.169781 host -> 13.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
76 10 0.173834 13.0 -> host USB 98 GET DESCRIPTOR Response CONFIGURATION
77 11 0.174505 host -> 13.0 USB 64 SET CONFIGURATION Request
78 12 0.175061 13.0 -> host USB 64 SET CONFIGURATION Response
79 13 0.175116 host -> 13.0 USBHID 64 SET_IDLE Request
80 14 0.175506 13.0 -> host USB 64 URB_CONTROL out
81 15 0.175694 host -> 13.0 USB 64 GET DESCRIPTOR Request Unknown type 34
82 16 0.181389 13.0 -> host USB 116 GET DESCRIPTOR Response Unknown type 34
83 17 0.200694 host -> 13.1 USB 64 URB_BULK in