0

I want to use USB-OTG on my Raspberry Pi 4, but I want to have a possibility to cut the power off and thus force reboot of the device.

Currently my RPi is powered via Power pins in 40 pin GPIO headers. I use USB-C in OTG mode to simulate external drive and/or external keyboard and mouse (depending on the test I perform).

My problem is that even when I cut the power from GPIO pins - the power provided from another device via USB-C is enough to keep my RPi from turning off.

To solve that I have a couple of ideas in mind:

  1. Using USB-C as power (again) and using OTG via GPIO pins. Unfortunately I couldn't find any information on how to connect GPIO pins to use them as OTG (maybe it is not possible).
  2. Separating each line in USB-C cable used for OTG and connecting V+/VBUS/Vcc through a relay that I could use to cut the power off. I'm worried that the breakout board I have for splitting USB-C might not be enough due to missing Tx and Rx pins - I use Adafruit 4090.

Do you think any of above solutions might work? What would be the best case?

0

1 Answer 1

2
  1. You can NOT use "OTG via GPIO pins" for many reasons - the most basic is that USB uses different voltage levels from GPIO.

  2. You can NOT power a Pi via USB, but due to limitations in the very basic power circuitry once booted the Pi can continue to run from USB power.

  3. USB clients are designed to be powered by the host, but the Pi in OTG mode continues to supply power. This is a known issue and can only be resolved by isolating USB power pins.
    This can be done by cutting the USB 5V power line but a better solution is to isolate with a Shottky diode so the Pi can power peripherals but NOT be powered by USB.

NOTE it is simple to reboot the Pi via software commands; it is not necessary to interrupt power.

3
  • Hi @Milliways and thanks for info, but you are not right in point 2. I thought that it is clear that I mean USB-C which is used for both power and usb-otg. So you can power a Pi via USB-C. This is the default way of powering a Raspberry Pi 4B. And - of course I know that one can reboot a Pi via software, but this would not be the case to e.g. test if stream got interrupted (simulating a broken cable). Commented Aug 5, 2024 at 11:53
  • The Pi4 DOES NOT have a USB-C port. It has a USB-C connector which is used for power and supports a limited subset of the USB PD specifications but could not be powered by a USC-C host (or USB2 host which is what the OTG connection supports - which for a standards compliant host will only supply 150mA; most hosts are not standards compliant). Commented Aug 5, 2024 at 12:17
  • 1
    You can always shutdown the Pi via GPIO using the gpio-shutdown overlay. Commented Aug 5, 2024 at 12:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.