Skip to main content
Visitor II
March 11, 2024
Question

STM32F446 USB

  • March 11, 2024
  • 1 reply
  • 902 views

Hi,

Just started working on a project based on the STM32F446RET MCU. Using the CubeIDE framework (code generated from .ioc file) and having some trouble with USB OTG FS Device mode. If I enable VBUS sensing, then the  USB doesn't enumerate. What's not clear to me is what I need to implement/do regarding the VBUS sense pin. The circuit is correct and wired into PA9, but is there an interrupt handler that I need to add? Any function that needs to be called when VBUS is detected?

 

Thanks!

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    March 11, 2024

    Hello @alexxs , 

     

    As mentioned in the STM32F446 datasheet (section 6.3.20 p. 136):

    "When VBUS sensing feature is enabled, PA9 and PB13 must be left at their default state (floating input), not as alternate function. A typical 200 µA current consumption of the sensing block (current to voltage conversion to determine the different sessions) can be observed on PA9 and PB13 when the feature is enabled."

    In order to reduce the voltage on PA9 below 4V, the usage of a voltage divider is recommended, so that AMR cannot be violated. But internal VBUS detection block inside OTG peripheral has certain current consumption. 

    Recommended resistor bridge is "vbus-- R1=4.7k -- R2=10k -- gnd" and then VBUS detection (PA9) can be taken between R1 and R2.

    I recommend you this FAQ on how VBUS sensing shall be managed: Management of VBUS sensing for USB device design.