1

I want to control lots of USB devices from a single Raspberry Pi. So far I have only tested with RPI4 and I could only connect about 5 devices concurrently. The limitation is caused first by the fact that both the USB 3.0 and 2.0 ports are controlled by the same XHCI controller, which supports fewer devices than USB 2.0 controllers, and also the fact that each device takes up more than one "endpoint", and the hubs also take up some endpoints, so the 32 theoretical devices turns into only 5 of the devices that I need to control.

I am waiting for an RPI3 which has USB 2.0 ports to see if the number of concurrent devices is higher, however I also noticed that the RPI has an I2C bus available via GPIO.

Is there some way that I can connect standard USB devices (ie. devices that are not "I2C compatible") to the I2C bus and communicate with them as if they were connected via standard USB/serial ports?

For context I currently use the "cu" command to get a terminal connection to the USB devices to send/receive strings.

If there were some way of addressing the devices over I2C instead, then I could theoretically connect many, many more devices to a single controller (the I2C spec says 1008 peripherals are supported).

Iain Dooley
  • 121
  • 2
  • Yes, there are i2c to usb adaptor, and also usb to i2c adaptor. Google is your friend. – tlfong01 Feb 01 '22 at 05:44
  • @tlfong01 From what I can see, the things that say they are USB/I2C bridges/adapters/converters seem to be focused on allowing a device with an I2C bus (such as a RPI) to connect to another machine's USB port, and communicate with that machine via I2C. I want a USB port into which I can plug a device such that the device will behave as if it is just connected to a standard USB port, then that port connects to the I2C bus and I can write code on the PI (as the controller) to communicate with each individual USB device (as a slave) – Iain Dooley Feb 01 '22 at 06:09
  • @tlfong01 just to clarify further: what I want to do is connect USB devices that are not I2C devices, to an I2C bus on the RPI where I can control them. Something like this "serial expansion HAT" but instead of providing multiple serial ports over I2C, I want to allow multiple USB ports over I2C https://www.waveshare.com/wiki/Serial_Expansion_HAT – Iain Dooley Feb 01 '22 at 06:34
  • clarifications belong in the question ... the question should not depend on comments to be understandable – jsotola Feb 01 '22 at 07:14
  • Let us forget i2c and use uart/serial to clarify. Rpi has up to 5 onboard serial ports. When I want more than 5, I can use say, 10 USB to serial adaptors. Does the usb//serial adaptor analogs your usb/i2c in your app domain? – tlfong01 Feb 01 '22 at 07:44
  • I skimmed your hat and found it using SC16IS752 (or similar, but I forgot the exact part number). I vaguely remember I used such modules before, because I wanted to use I2C/SPI to create serial ports. Is it what you want? – tlfong01 Feb 01 '22 at 07:48
  • @jsotola my clarification repeats what is already in the question – Iain Dooley Feb 01 '22 at 22:32
  • 1
    @tlfong01 given the fact that there is such a thing as USB to serial converter, I suppose that would do: I could use the same design as the serial expansion HAT to create serial ports, then use a usb to serial converter so I could plug my USB devices into it. I thought there might be a way to do it that avoided using a USB to serial converter, but if not then that would also work I could just use them as serial devices, thanks – Iain Dooley Feb 01 '22 at 22:33
  • @Iain Dooley, How nice to hear that you have found a way to explore at. BTW, two more references you might find useful: (1) Multiple Rpi Serial Ports Problem Asked 2 years, 8 months ago Active 2 months ago Viewed 2k times https://raspberrypi.stackexchange.com/questions/98393/multiple-rpi-serial-ports-problem

    (2) How many serial ports are on the Pi 3? Asked 2 years, 9 months ago Active 2 years, 9 months ago Viewed 13k times https://raspberrypi.stackexchange.com/questions/96697/how-many-serial-ports-are-on-the-pi-3. Good luck and cheers.

    – tlfong01 Feb 02 '22 at 02:13
  • 1
    @tlfong01 great resources thanks – Iain Dooley Feb 02 '22 at 03:06
  • Is there a reason your not just using ssh? Basically unlimited connections? – cybernard Feb 02 '22 at 18:47
  • @cybernard the USB devices that I need to control don't have SSH servers running on them, they communicate over USB (although that could be converted to serial). I use cu -s 115200 -l /dev/ttyUSBX to connect – Iain Dooley Feb 02 '22 at 23:31

0 Answers0