KB2040 - D+/D- pins change behavior after plugging in USB cable

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ebyerly
 
Posts: 8
Joined: Wed Mar 08, 2023 11:22 am

KB2040 - D+/D- pins change behavior after plugging in USB cable

Post by ebyerly »

I have a KB2040 flashed as a keyboard using QMK. I am working on making a mechanical keyboard that has two modes:

- wireless, where the keyboard feeds its output to an onboard terminal-only Raspberry Pi Zero (the RPiZero's D+ and D- test pads are wired to the KB2040's D+ and D- pins)
- wired, where the keyboard feeds its output to the device connected by a USB cable

I have both modes working successfully when I power on into either. Here's the sequence of behavior I want to understand better:

1. Boot system in wireless mode
2. KB2040 successfully writes keycodes to RPiZero
3. Plug in USB cable to KB2040 connecting it to my desktop
4. KB2040 successfully writes keycodes to my desktop
- Note, it does not double write (output keycodes to both the onboard RPiZero and the connected device) and it would be an acceptable outcome if it double writes
5. Unplug the USB cable
6. KB2040 no longer writes keycodes to RPiZero

Interestingly, the KB2040 continues to not write on the RPiZero even after restarting the KB2040 by itself. I have to restart the RPiZero before it will start reading the keycodes again.

Help?

User avatar
ebyerly
 
Posts: 8
Joined: Wed Mar 08, 2023 11:22 am

Re: KB2040 - D+/D- pins change behavior after plugging in USB cable

Post by ebyerly »

Two addendums:

- this behavior occurs whether the KB2040 is connected to a USB cable that uses the data lines _or_ a USB cable that is handling solely power delivery
- this behavior smells like some flavor of "USB standard doesn't support multiple readers / you need a USB hub IC intermediating the KB2040 and the RPiZero/external cable", but I want to narrow it down as much as possible

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”