0
\$\begingroup\$

I have a device constructed from a Raspberry Pi 3 B and an AVR based USB device. The interconnection of these components is depicted in this picture.

enter image description here

When RPI is on, data lines of keyboard will be connected to the USB port of RPI. When RPI is off and a USB cable from PC is connected to the device, then data lines of the USB keyboard will be connected to that USB port.

The problem is that when using Raspbian Buster, the OS doesn't detect the USB keyboard at all. It isn't listed in dmesg logs nor in lsusb output. I know that maybe this is not the standard interconnection, but I can not change the hardware. And more importantly, this setup works great with Raspbian Stretch.

So, although this detection problem may be caused by the connection architecture, but there must be a software solution because as I mentioned, the USB keyboard is detected and working when the OS of RPI is Raspbian Stretch.

I think the problem lies in the RPI firmware changes that happened from Stretch to Buster, but downgrading firmware using rpi-update didn't help.

What can I do to make the Buster firmware detect this USB keyboard as Stretch does? As I mentioned, downgrading the Buster firmware/kernel from 4.19.57-v7+ to 4.9.35-v7+ (the firmware/kernel version of the working stretch release that I have) didn't help.

If it matters, the USB keyboard is an AVR based CDC device.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ What's in the switch box? Should PC always power the keyboard? Why there is no ground connection from RPi to keyboard? \$\endgroup\$ – Justme Nov 22 '20 at 12:04
  • \$\begingroup\$ @Justme My bad! its just a simple connector, data lines of both usb ports are connected together. and also when there is no power from PC, it comes from battery. \$\endgroup\$ – payman Nov 22 '20 at 12:32
  • \$\begingroup\$ But you data lines must go between two devices only. You can't have a Y split on the bus. You can't have three devices on same bus. Or have I misunderstood something about your setup? Do you mean a USB powerbank instead of battery? \$\endgroup\$ – Justme Nov 22 '20 at 12:46
  • \$\begingroup\$ Just one device is connected to keyboard at a time. either PC is disconnected and Pi on or Pi is off and PC is connected. \$\endgroup\$ – payman Nov 22 '20 at 19:16
  • \$\begingroup\$ If Pi is off but connected while PC is connected, that won't work either. USB is simply not meant to be split into three, no matter if something is connected or not. \$\endgroup\$ – Justme Nov 22 '20 at 19:27
1
\$\begingroup\$

Try connecting the ground of the RPi to the ground of the keyboard and PC connector. Without a common ground the USB data lines may be exceeding the common-mode range of the RPi's circuits.

If you can't make this ground connection, and you remain convinced that there is a software solution, move your question to a more appropriate forum.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.