cancel
Showing results for 
Search instead for 
Did you mean: 

VBUS sensing on STM32L0?

petejohanson
Associate

I'm trying to understand the correct way to do self-powered devices with STM32L0. Most datasheets for other MCUs document using PA9 as a sensing pin using an alternate function, but I'm not finding this for L073, which I'm using on a Nucleo L073RZ board.

Do I need to do this all at my application level with a different normal GPIO pin and enable/disable USB functionality at that layer?

3 REPLIES 3
Peter BENSCH
ST Employee

Welcome @petejohanson, to the community!

VBUS is part of the Host functionality, which is also included with USB OTG. However, STM32L073 has USB with Device functionality and therefore does not offer VBUS.

Does it answer your question?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Peter,

I am trying to use this as a USB *self-powered* device, which means *sometimes* there will be an upstream host, and other times there won't. I need to detect which state I'm in, which is usually done on devices via VBUS sensing. Right now, it seems the HAL layer (I'm using Zephyr RTOS layered over the ST HAL) is triggering the "suspended" callback, which, AFAICT, is happening because there's no VBUS sensing set available on L0 hardware to even have the HAL piece properly detect the *disconnected* state which it is really in.

Am I missing something?

EZHON.1
ST Employee

There are two cases:
• The USB device is bus-powered. VBUS sensing is not mandatory (USB is always connected when the
device is powered)
• The device is self-powered. VBUS sensing is mandatory.

PA9 is not the mandatory for self-powered, any GPIO with 5V FT is good for detection.

please refer AN4879 on www.st.com.