Skip to content

arduino-usbserial: non-working Product string #431

Open
@agners

Description

@agners

When using an Arduino Mega 2560 R3 is connected to a Raspberry Pi running the U-Boot boot loader, it crashes the boot loader during USB enumeration:

Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices...
Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401)

Debugging the problem showed that Arduino (or rather the ATmega16U2) announces a product string but does not report one when trying to get the product string (string id 2). This seems to be reproducible on Linux, but Linux seems to recover from the problem:

[285133.943073] usb 3-2: new full-speed USB device number 7 using xhci_hcd
[285134.118097] usb 3-2: New USB device found, idVendor=2341, idProduct=0042, bcdDevice= 0.01
[285134.118103] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[285134.118106] usb 3-2: Manufacturer: Arduino (www.arduino.cc)
[285134.118108] usb 3-2: SerialNumber: 85433333231351B0B2B1
[285134.164149] cdc_acm 3-2:1.0: ttyACM0: USB ACM device

Note the Product=2, but there is no Product: ... line. The device does not report a USB product string

This can be seen in Wireshark nicely, the string request for Descriptor Index: 0x02 does not get a proper Response STRING back. Linux seems to retry 6 times and then giving up and continuing with Descriptor Index: 0x01, which seems to work:

image

Wireshark trace: ArduinoMega2560-NoProductString.tar.gz

Not sure if this is violating the USB spec or just not being nice, but I think a fix should be rather trivial.

I am not 100% sure where the firmware for the ATmega16U2 of the Arduino Mega R3 comes from, but I assume its from firmwares/atmegaxxu2/arduino-usbserial/? If so, then it seems that there is a preprocesssor define missing in the product string descriptor table:

const USB_Descriptor_String_t PROGMEM ProductString =

My device's product ID is 0x0042 but ARDUINO_MEGA2560_PID seems to be 0x0010....

(this has been noticed when using Arduino Mega connected to systems running Home Assistant OS: home-assistant/operating-system#1011)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions