STM32 USB VBUS 监控

OTG_FS general core configuration register (OTG_FS_GCCFG)

Bit 21 NOVBUSSENS: VBUS sensing disable option

When this bit is set, VBUS is considered internally to be always at VBUS valid level (5 V).

This option removes the need for a dedicated VBUS pad, and leave this pad free to be used for other purposes such as a shared functionality.

VBUS connection can be remapped on another general purpose input pad and monitored by software.

This option is only suitable for host-only or device-only applications.

0: VBUS sensing available by hardware
1: VBUS sensing not available by hardware.

如果需要使用 VBUS 引脚作为其他功能,NOVBUSSENS = 1

According to the reference manual for the STM32F205, page 945, you want to do the following:

First, you want to disable the VBUS sensing option.

This is done by setting the NOVBUSSENS bit in the OTG_FS_GCCFG register.

In this case VBUS is considered internally to always be at VBUS valid level (5 V),

so you don't need to run a trace from the VBUS pin on the USB connector over to the STM32F205 at all.

原文地址:https://www.cnblogs.com/shangdawei/p/4334250.html