November 17, 2023

Let's learn USB! -- F103 papoon Enumeration in detail

No cutting corners. We will look at each packet using Wireshark to analyze the replies.

1 - first exchange, device descriptor

2 Enum Rx S 8010 EA60 8 8006000100004000
3 Enum Tx   8000 62A0 18 120100020200004083044057000201020301

Frame 278: 82 bytes on wire (656 bits), 82 bytes captured (656 bits) on interface usbmon2, id 0
USB URB
DEVICE DESCRIPTOR
    bLength: 18
    bDescriptorType: 0x01 (DEVICE)
    bcdUSB: 0x0200
    bDeviceClass: Communications and CDC Control (0x02)
    bDeviceSubClass: 0
    bDeviceProtocol: 0
    bMaxPacketSize0: 64
    idVendor: STMicroelectronics (0x0483)
    idProduct: Virtual COM Port (0x5740)
    bcdDevice: 0x0200
    iManufacturer: 1
    iProduct: 2
    iSerialNumber: 3
    bNumConfigurations: 1

2 - second exchange, device qualifier (no reply)
3 - third exchange, device qualifier (no reply)
4 - fourth exchange, device qualifier (no reply)
(yes, repeated 3 times and never replied to)

11 Enum Rx S 8010 EA60 8 8006000600000A00
12 Enum Tx   8000 72A0 0

5 - fifth exchange, configuration descriptor

20 Enum Rx S 8010 EA60 8 8006000200000900
21 Enum Tx   8000 62A0 9 09024300020100C032
Frame 286: 73 bytes on wire (584 bits), 73 bytes captured (584 bits) on interface usbmon2, id 0
USB URB
CONFIGURATION DESCRIPTOR
    bLength: 9
    bDescriptorType: 0x02 (CONFIGURATION)
    wTotalLength: 67
    bNumInterfaces: 2
    bConfigurationValue: 1
    iConfiguration: 0
    Configuration bmAttributes: 0xc0  SELF-POWERED  NO REMOTE-WAKEUP
    bMaxPower: 50  (100mA)

6 - sixth exchange, the big configuration descriptor

23 Enum Rx S 8010 EA60 8 8006000200004300
24 Enum Tx   8000 62A0 64 09024300020100C03209040000010202010005240010010524010001042402020524060001070582030800FF09040100020A0000000705030240000007058102
25 Enum Tx   8000 62E0 3 400000
Frame 288: 131 bytes on wire (1048 bits), 131 bytes captured (1048 bits) on interface usbmon2, id 0
USB URB
CONFIGURATION DESCRIPTOR
    bLength: 9
    bDescriptorType: 0x02 (CONFIGURATION)
    wTotalLength: 67
    bNumInterfaces: 2
    bConfigurationValue: 1
    iConfiguration: 0
    Configuration bmAttributes: 0xc0  SELF-POWERED  NO REMOTE-WAKEUP
        1... .... = Must be 1: Must be 1 for USB 1.1 and higher
        .1.. .... = Self-Powered: This device is SELF-POWERED
        ..0. .... = Remote Wakeup: This device does NOT support remote wakeup
    bMaxPower: 50  (100mA)
INTERFACE DESCRIPTOR (0.0): class Communications and CDC Control
    bLength: 9
    bDescriptorType: 0x04 (INTERFACE)
    bInterfaceNumber: 0
    bAlternateSetting: 0
    bNumEndpoints: 1
    bInterfaceClass: Communications and CDC Control (0x02)
    bInterfaceSubClass: Abstract Control Model (0x02)
    bInterfaceProtocol: AT Commands: V.250 etc (0x01)
    iInterface: 0
COMMUNICATIONS DESCRIPTOR
    bLength: 5
    bDescriptorType: 0x24 (CS_INTERFACE)
    Descriptor Subtype: Header Functional Descriptor (0x00)
    CDC: 0x0110
COMMUNICATIONS DESCRIPTOR
    bLength: 5
    bDescriptorType: 0x24 (CS_INTERFACE)
    Descriptor Subtype: Call Management Functional Descriptor (0x01)
    bmCapabilities: 0x00
    Data Interface: 0x01
COMMUNICATIONS DESCRIPTOR
    bLength: 4
    bDescriptorType: 0x24 (CS_INTERFACE)
    Descriptor Subtype: Abstract Control Management Functional Descriptor (0x02)
    bmCapabilities: 0x02
        0000 .... = Reserved: 0x0
        .... 0... = Network_Connection: Not supported
        .... .0.. = Send_Break: Not supported
        .... ..1. = Line Requests and State Notification: Supported
        .... ...0 = Comm Features Combinations: Not supported
COMMUNICATIONS DESCRIPTOR
    bLength: 5
    bDescriptorType: 0x24 (CS_INTERFACE)
    Descriptor Subtype: Union Functional Descriptor (0x06)
    Control Interface: 0x00
    Subordinate Interface: 0x01
ENDPOINT DESCRIPTOR
    bLength: 7
    bDescriptorType: 0x05 (ENDPOINT)
    bEndpointAddress: 0x82  IN  Endpoint:2
        1... .... = Direction: IN Endpoint
        .... 0010 = Endpoint Number: 0x2
    bmAttributes: 0x03
        .... ..11 = Transfertype: Interrupt-Transfer (0x3)
    wMaxPacketSize: 8
        ...0 0... .... .... = Transactions per microframe: 1 (0)
        .... ..00 0000 1000 = Maximum Packet Size: 8
    bInterval: 255
INTERFACE DESCRIPTOR (1.0): class CDC-Data
    bLength: 9
    bDescriptorType: 0x04 (INTERFACE)
    bInterfaceNumber: 1
    bAlternateSetting: 0
    bNumEndpoints: 2
    bInterfaceClass: CDC-Data (0x0a)
    bInterfaceSubClass: 0x00
    bInterfaceProtocol: No class specific protocol required (0x00)
    iInterface: 0
ENDPOINT DESCRIPTOR
    bLength: 7
    bDescriptorType: 0x05 (ENDPOINT)
    bEndpointAddress: 0x03  OUT  Endpoint:3
        0... .... = Direction: OUT Endpoint
        .... 0011 = Endpoint Number: 0x3
    bmAttributes: 0x02
        .... ..10 = Transfertype: Bulk-Transfer (0x2)
    wMaxPacketSize: 64
        .... ..00 0100 0000 = Maximum Packet Size: 64
    bInterval: 0
ENDPOINT DESCRIPTOR
    bLength: 7
    bDescriptorType: 0x05 (ENDPOINT)
    bEndpointAddress: 0x81  IN  Endpoint:1
        1... .... = Direction: IN Endpoint
        .... 0001 = Endpoint Number: 0x1
    bmAttributes: 0x02
        .... ..10 = Transfertype: Bulk-Transfer (0x2)
    wMaxPacketSize: 64
        .... ..00 0100 0000 = Maximum Packet Size: 64
    bInterval: 0

7 - seventh exchange, string descriptor (language)

27 Enum Rx S 8010 EA60 8 800600030000FF00
28 Enum Tx   8000 62A0 4 04030904
Frame 290: 68 bytes on wire (544 bits), 68 bytes captured (544 bits) on interface usbmon2, id 0
USB URB
STRING DESCRIPTOR
    bLength: 4
    bDescriptorType: 0x03 (STRING)
    wLANGID: English (United States) (0x0409)

8 - 8th exchange, string descriptor

30 Enum Rx S 8010 EA60 8 800602030904FF00
31 Enum Tx   8000 62A0 46 2E0355006E0063006C00650020004A006F006500270073002000730065007200690061006C00200049004F002000
Frame 292: 110 bytes on wire (880 bits), 110 bytes captured (880 bits) on interface usbmon2, id 0
USB URB
STRING DESCRIPTOR
    bLength: 46
    bDescriptorType: 0x03 (STRING)
    bString: Uncle Joe's serial IO 

9 - 9th exchange, string descriptor

33 Enum Rx S 8010 EA60 8 800601030904FF00
34 Enum Tx   8000 62A0 38 260353005400200061006E006400200055006E0063006C00650020004A006F00650020002000
Frame 294: 102 bytes on wire (816 bits), 102 bytes captured (816 bits) on interface usbmon2, id 0
USB URB
STRING DESCRIPTOR
    bLength: 38
    bDescriptorType: 0x03 (STRING)
    bString: ST and Uncle Joe  

10 - 10th exchange, string descriptor

36 Enum Rx S 8010 EA60 8 800603030904FF00
37 Enum Tx   8000 62A0 12 0C0331003300310033000000
Frame 296: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface usbmon2, id 0
USB URB
STRING DESCRIPTOR
    bLength: 12
    bDescriptorType: 0x03 (STRING)
    bString: 1313

11 - 11th exchange, set configuration

39 Enum Rx S 8010 EA60 8 0009010000000000
40 Enum Tx   8000 72A0 0

12 - 12th exchange, set line coding request (no response)

41 Enum Rx S 8010 EA60 8 2120000000000700
Frame 299: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface usbmon2, id 0
USB URB
Setup Data
    bmRequestType: 0x21
    USB Communications and CDC Control
        [Subclass: Abstract Control Model (0x02)]
        Request Code: SET LINE CODING (0x20)
        Value: 0
        Index: 0
        Length: 7
        Payload: 80250000000008
    Data Fragment: 80250000000008

13 - last exchange, Control out, no response

42 Enum Rx   8010 A270 7 80250000000008

And there it is!!

That is the whole thing with quite a lot of detail. More can be learned by digging around in papoon and finding the data that generates the responses. In general it is preformated, expected, and spit out on demand.

That is the nature of enumeration. A scripted bunch of responses are set up in the device and handed out when they are asked for.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org