About self-powered device VBUS monitor question

Away_480522
Posts: 3
Joined: Mon Aug 21, 2023 3:56 am

About self-powered device VBUS monitor question

Postby Away_480522 » Thu Dec 14, 2023 1:12 am

I would like to ask, what is the role of ESP32-S3 TinyuSB's VBUS monitoring, and what are the consequences of not monitoring VBUS for self powered devices? Will there be any issues with USB sending data if the USB cable is disconnected and reconnected without monitoring VBUS?
I made a self powered device using ESP32-S3 as the main chip and used it as a USB CDC device. I also set up monitoring VBUS pin during the installation of the tinyuSB driver. But there is still a situation where the data sent by USB to the PC cannot be displayed when reconnecting after USB disconnection. I am not sure what the reason is, can anyone help explain it?

tore-espressif
Posts: 19
Joined: Thu Oct 07, 2021 8:11 am

Re: About self-powered device VBUS monitor question

Postby tore-espressif » Fri Jan 12, 2024 9:36 am

Hi,
The USB VBUS monitoring is only relevant for self-powered devices, that is devices that can operate even when there is no USB connection.
The consequence of NOT monitoring the VBUS, is that the device's software won't be able to distinguish between USB Suspend and USB disconnection. Suspend means that no data is send on the USB bus - typically used for power saving. Disconnection means that the device was unplugged from the USB port.
If your application does not care about this, you do not have to monitor VBUS (although that is AGAINST the USB specification). You can simply react on the Suspend callback from TinyUSB. Just define

Code: Select all

void tud_suspend_cb(bool remote_wakeup_en);
in your application.

Also please note that we have a regression in latest TinyUSB, that might affect your application, please follow the steps described there to used older version of TinyUSB https://github.com/espressif/esp-idf/issues/12360
But there is still a situation where the data sent by USB to the PC cannot be displayed when reconnecting after USB disconnection.
After the disconnection, no data can be send. You must wait until the USB is connected again to continue sending new data

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 137 guests