sekigon-gonnoc / Pico-PIO-USB

USB host/device implementation using PIO of raspberry pi pico (RP2040).
MIT License
1.3k stars 137 forks source link

🪲[BUG] control in[error] Enumeration failed(-1) #86

Open benaclejames opened 1 year ago

benaclejames commented 1 year ago

Describe the bug you encountered: I've been attempting to get the example capture_hid_report code working, but upon running and testing it, I discovered that most keyboards, when plugged in, don't actually print anything to the uart. A select few that I've tried do print something to the log when plugged in or when a key is pressed, but it appears there's an error with parsing or reading anything the device is sending.

What did you expect to happen instead?

I'm expecting the keyboard to show up in UART and display received data

What actually happened in your case?

Root 0 connected
Device 0 Connected
control in[error]
Enumeration failed(-1)
Root 0 disconnected
Disconnect
Disconnect device 0

The above error is printed any time a button is pressed or whenever the keyboard is plugged in (on the few keyboards I own that seem to get somewhat recognized by the pico).

Additional information

Standard cmake compile setup using ninja for builds via the Windows pico-sdk's included VSCode install. Latest SDK, latest repo version, using a Pico W.

It's possible I might just be doing something wrong on the hardware side, but for the moment I just have the USB device connected to D+ on gp0 and D- on gp1.

Thanks so much for this :)

Jakii04 commented 1 year ago

I also have this issue when I am trying to communicate with an arduino mega 2560 (using Raspberry Pi Pico). The D+ Pin is connected to GP2 and D- to GP3.

GamerMine commented 1 month ago

Hello, I have the same problem, but, I found that if I use recent devices like a Corsair Harpoon gaming mouse, it works like it should. From this point, I don't really know why it does not work with older devices. When trying with a Rigol DS1102 Z-E, or an old Microsoft mouse, it says this exact same error. I don't know, what does it means, I will try to figure it out

benzeneringlq commented 1 month ago
  1. exchange D+ and D-
  2. don't use ${PICO_SDK_PATH}/lib/tinyusb/hw/mcu/raspberry_pi/Pico-PIO-USB. Use ${CMAKE_CURRENT_SOURCE_DIR}/../Pico-PIO-USB hand git clone by myself solved my question
holly-hacker commented 1 day ago

I'm getting the same error with the capture_hid_report example, having tried multiple pi picos, multiple HID devices, and various breadboards/breadboard wires/resistor configurations to rule out flaky connections being the problem. Swapping the data wires results in the exact same error and serial logging.

This is the serial logging I get every time I plug in a device:

Root 0 connected
Device 0 Connected
ep is NULL # manually added log line on `ep == NULL`
control in[error]
Enumeration failed(-1)
Root 0 disconnected
Disconnect
ep is NULL # manually added log line on `ep == NULL`
Disconnect device 0

When unplugging the device, I get the following:

Root 0 disconnected

The HID device itself does get power but does not properly initialize.

I've been trying to get this to work for a while, but the error logging is very lacking. I'll post more info if I make any progress.

holly-hacker commented 1 day ago

After more testing, I've come to the conclusion that there must still be some flaky connection with the breadboard or wires I'm using. I switched to a Pimeroni tiny2350 and connected the USB breakout board directly with female-to-female jumper wires and now some devices seem to mostly correctly run the capture_hid_report example.

I still haven't figured some other weird behavior that happens with some devices and when unplugging devices, I'll post here or in other issues when I figure out why that is and whether it is a bug or not.