Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

STM32. What should be done in firmware for VBUS detection through a GPIO pin?

kender

Advanced Member level 4
Advanced Member level 4
Joined
Jun 19, 2005
Messages
1,428
Helped
138
Reputation
276
Reaction score
39
Trophy points
1,328
Location
Stanford, SF Bay Peninsula, California, Earth, Sol
Activity points
10,071
I've got a is self-powered USB device, which means that I have to do VBUS detection. The device is built around STM32G474. Unlike some other STM32s, the STM32G4 don't have a dedicated pin for VBUS detection, so I have to do it through a GPIO pin and firmware. VBUS is connected to the GPIO pin PA10 through a 2x 100kΩ divider. What should be done in firmware for VBUS detection through a GPIO pin?

I checked the code examples for STM32G4s, but I couldn’t find examples for USB. If somebody could point me to a code example, that would be great.

I’ve read this knowledgebase article on VBUS detection which is a collection of excerpts from AN4879 (and I’ve read the app note too).

Any 5V tolerant pin with external interrupt functionality... [from knowledgebase article]

Does the VBUS detection have to be done in an interrupt? Or can it be done in the main loop? If it can be done in the main loop, then are there timing constraints?

However, the disadvantage of this solution is that the software handling of VBUS presence event needs to be implemented by the user. This is not managed within our STM32 USB library for the time being. [from the same knowledgebase article]

I have to pick up where that knowledgebase article left off. What should the firmware do when it detects that VBUS (re)appeared? What should the firmware do when VBUS has disappeared?
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top