Can I connect USB devices via GPIO and not USB ports? Is it possible? What hardware is needed to do this?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
It may be possible to connect a USB controller to the UART pins.
It apparently has a
Simple UART and I2C interface. However it will be seriously limited by speed. It is only capable of transmitting at 115200 baud, which is significantly slower than USB. There will also by no way in which to map the UART pins to the existing USB interface, meaning that items connected wont be recognisable as USB devices.
I might be able to provide you with a better solution if you are able to state what you are trying to accomplish.
You can connect the Raspberry Pi as a USB peripheral to a USB host using a USB to TTL cable which the RPi will see as a serial console port.
Note that that is not a passive USB cable with header connectors. There are electronics in the oversized USB plug that does the USB to serial conversion.
There are embedded USB host chips (really special purpose microcontrollers with embedded USB stacks) such as the Vinculum from FTDI, which can be controlled over interfaces such as SPI or perhaps asynchronous serial. One of these could be interfaced to the GPIO or alternate functions on the GPIO pins.
However, this would be an expensive and limited solution compared to using the built-in USB host capability, extended with a hub if needed - they really exist for the sake of people who just have to hang a USB device off of something like an Arduino which lacks any native USB host capability. And it's not like an embedded USB host would get around the limitations on power passing through the pi, either - you would still need to rig up an alternate power routing, at which point you might as well just use a powered USB hub plugged into the pi normally.
Perhaps the one narrow case in which it might make sense would be if you wanted to run a very primitive bare-metal program on the pi, without bothering with incorporating a USB host stack into your custom firmware.