ESP32-S3 VBUS Detect - alternatives to GPIO pin

bandsaws
Posts: 1
Joined: Sun Apr 13, 2025 4:42 pm

ESP32-S3 VBUS Detect - alternatives to GPIO pin

Postby bandsaws » Sun Apr 13, 2025 5:48 pm

Hi all-

I'm working on a new industrial device that has the ability to work with both self-power and bus-power. It uses two eFuses and a USB-C PD chip to autonegotiate a power source through a fairly complex set of circuitry, and has substantial protection circuitry between the processor and the inputs.

As the documentation says, if you have a device that is self-powered, you need to implement your own VBUS detection to determine when a cable is attached or removed. https://docs.espressif.com/projects/esp ... red-device indicates the default approach is to use a voltage divider to attach the VBUS signal to a pin, then use that pin number when initializing the USB stack for .vbus_monitor_io.

Under the covers, it appears this results in that pin being directly mapped to a signal that goes into the PHY, vbusvalid. https://github.com/espressif/esp-idf/bl ... phy.c#L115

I'm in a situation where I'd like to take a different approach and not use a GPIO pin:

- A simple voltage divider is complicated because VBUS may be any voltage between 5V and 20V, and requires external components/board space
- I'm out of GPIO pins and want to reclaim the pin used for VBUS detection
- My USB-C PD controller knows if a cable is plugged in, but it communicates via I2C with the host, not GPIO

So the approach I'd like to take is to communicate with my USB-C PD controller, then write a register or call a function when a plug or disconnect event occurs.

Is there a supported way to do this? If not, the documentation indicates the PHY is a proprietary design - can someone with access to these suggest the appropriate way to communicate with it to indicate that a connection or disconnection has happened?

Thanks in advance!

Sprite
Espressif staff
Espressif staff
Posts: 10650
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 VBUS Detect - alternatives to GPIO pin

Postby Sprite » Mon Apr 14, 2025 1:18 am

There might be a more direct way, for that you'd have to dig into the USB-OTG docs, but an indirect way would be to set that signal to any random GPIO (so the driver can initialize it) and then use the GPIO matrix to re-route it to either the always-high (0x38) or always-low (0x3C) pseudo-GPIO, depending on the value you want.

Who is online

Users browsing this forum: No registered users and 1 guest