-
Notifications
You must be signed in to change notification settings - Fork 946
rp2040: failed enumeration #4137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Update. Tested again on 0.31.1. This is easily reproducible on 0.31.1 as well. |
Having the exact same issue on linux while running basic hello world example... Did you manage to fix it? [163761.929936] usb 1-4: new full-speed USB device number 55 using xhci_hcd |
The rp2040 usb can be a little finicky depending on the version of the processor you are using. That is not specific to TinyGo it is for all versions of rp2040 below a certain revision of the chip. |
I found a potential workaround for the USB enumeration issue. Adding the following code to the handleUSBSetAddress function in machine_rp2040_usb.go resolved the "Unknown USB device" error on my Windows 11 Pro:
This modification adjusts the timing of USB address setting. According to the USB specification, after receiving a SetAddress request, a device must set its new address before the next status stage, but the response time was too fast. While this fix works in my environment, I don't have the proper testing equipment to verify if this is the correct approach. I would appreciate if others could test whether this has the same effect in their environments and provide feedback on the approach itself. If the effectiveness is confirmed, I would like to create a pull request for this fix. |
Tagging this issue to be closed after next release. |
Now closing with 0.37.0 release. Thanks! |
Hello!
I'm trying to make a simple 4 switch keypad with a Seeed Studio XIAO RP2040. I can successfully compile with no errors or warnings, and then also (seemingly) successfully flash the device with the resulting uf2. The issue is, more often than not, the device after flashing fails to enumerate in Windows 10. I get the most success when I start with the device unplugged, boot, and then flash. It tends to work under those circumstances. If I reset the device using the reset button, it tends to fail. I can reproduce this with both v0.29 and v0.30, I haven't tried other versions of tinygo.
I've also tried adding println statements to debug over serial. When the device is in the failure state, the tinygo monitor is unable to locate the COM port. I'm happy to try other troubleshooting or debug steps, but I'm not versed enough with tinygo to know what would be useful here. In my perusing of the issues list, it seems like this could be related to this: #3012
Here's what device manager looks like when the device is in the failure state:

Here's the code being compiled:
Here's the command I'm using to compile:
tinygo build -target=xiao-rp2040 -o firmware.uf2 main.go
The text was updated successfully, but these errors were encountered: