Skip to content

SAMD21 USB host not working #3298

@maxgerhardt

Description

@maxgerhardt

Operating System

Windows 10

Commit SHA

331c263

Board

Adafruit Feather M0 (RFM95)

Firmware

https://github.com/maxgerhardt/samd21-usb-host-repro/

What happened ?

When starting up the TinyUSB stack configured for just USB host, and with only the CDC host driver enabled, no hubs, the enumeration of USB devices files with a timeout.

When using the same hardware with the USBHost library (https://github.com/arduino/ArduinoCore-samd/tree/master/libraries/USBHost/examples/USB_desc), it can enumerate the USB device just fine.

Starting USB Descriptor test
Initializing USB

01
--

Device descriptor: 
Descriptor Length:12
Descriptor type:01
USB version:0110
Device class:00
Device Subclass:00
Device Protocol:00
Max.packet size:40
Vendor  ID:10C4
Product ID:EA60
Revision ID:0100
..

How to reproduce ?

  • Download reference firmware repo in VSCode + PlatformIO extension
  • Plug in Adafruit Feather M0 via USB port, quickly double-press RESET button to get it into USB bootloader mode
  • Upload firmware via project tasks -> Upload
  • Unplug the USB cable from the Feather M0
  • Use a USB-to-UART adapter with VCC, GND and RX connected to "USB", "GND" and "TX1" of the Feather (gives the Feather power and can read debug logs)
  • use a micro USB OTG adapter to get a female USB-A port on on the Feather
  • plug in a device (example: CP2102 adapter)

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

TinyUSB Dual Device Info Example
Enabling USB clock
Setting USB handler
Beginning USB host
USBH init on controller 0, speed = Full
sizeof(usbh_data_t) = 28
sizeof(usbh_device_t) = 94
sizeof(hcd_event_t) = 12
sizeof(tuh_xfer_t) = 24
sizeof(tu_fifo_t) = 12
sizeof(tu_edpt_stream_t) = 20
Got 1 host drivers
CDC init
sizeof(cdch_interface_t) = 200
Initialized all drivers, now initing controller
Resetting USB controller
Done restting USB controller
Waiting for USB sync
Got USB sync
Enabling USB interrupts now
Beginning USB host done
[0:] USBH Device Attach
Full Speed
[0:0] Open EP0 with Size = 8
Get 8 byte of Device Descriptor
[0:0] Get Descriptor: 80 06 00 01 00 00 08 00
[:0] on EP 00 with 8 bytes: OK
[:0] on EP 80 with 8 bytes: OK
[0:0] Control data:
  0000:  12 01 10 01 00 00 00 40                          |.......@|
[:0] on EP 00 with 0 bytes: TIMEOUT

Screenshots

Image

I have checked existing issues, discussion and documentation

  • I confirm I have checked existing issues, discussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions