Skip to content

RP2040: Basic USB HID keyboard #682

@mrusme

Description

@mrusme

As commented here I am trying to make a RP2040 act as a basic USB HID keyboard using MicroZig but I keep seeing the following dmesg output when connecting the flashed device:

[621572.994620] usb 1-1: new full-speed USB device number 83 using xhci_hcd
[621573.019218] usb 1-1: not running at top speed; connect to a high speed hub
[621573.028217] usb 1-1: unable to read config index 0 descriptor/start: -61
[621573.028229] usb 1-1: can't read configurations, error -61
[621573.144617] usb 1-1: new full-speed USB device number 84 using xhci_hcd
[621573.169223] usb 1-1: not running at top speed; connect to a high speed hub
[621573.178216] usb 1-1: unable to read config index 0 descriptor/start: -61
[621573.178226] usb 1-1: can't read configurations, error -61
[621573.178341] usb usb1-port1: unable to enumerate USB device

I'm running rp2040.init(); and rp2040.time.sleep_ms(5); at the very top of my pub fn main() void, I use const usb_hal = rp2040.usb; and initialize my UsbDevice using const UsbDevice = usb_hal.Usb(.{}); and make sure to UsbDevice.init_clk(); and UsbDevice.init_device(&device_config) before jumping into the main loop, in which I'm trying to do the typing.

It appears that people have attempted to implement a USB HID keyboard using MicroZig, but unfortunately there appears to be no example code to do so available anywhere online.

Maybe the core team can provide pointers as to how this can be achieved with MicroZig?

PS: Would have opened this as a discussion but it appears discussions aren't enabled on this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions