Skip to main content
Graduate II
February 26, 2025
Question

USB over current (OTG_FS_OC) - how should application respond?

  • February 26, 2025
  • 2 replies
  • 1259 views

I have an application with STM32F4 OTG configured as USB Host, MSC, using ST's USB Host middleware and FatFS. How should it respond to rising and falling edges on the OverCurrent signal, such as pictured below (from the STM32F429I-DISC1 schematic)?

 

BMcDo3_0-1740579195752.png

 

CubeMX config:

BMcDo3_1-1740580311315.png

 

    This topic has been closed for replies.

    2 replies

    Super User
    February 26, 2025

    The USB spec requires that power is cut in response to an overcurrent condition.

    BMcDo.3Author
    Graduate II
    February 26, 2025

    Which USB spec and what section? If you know.

    How would I cut the power? Release the EN' pin on the STMPS2141STR (set OTG_FS_PSO high)? Does the STMPS2141STR not protect itself and recover sufficiently without this? If I disable the STMPS2141STR, how do I know when it's safe to re-enable? Would I have to just periodically try enabling it again, and check its FAULT' pin (OTG_FS_OC) status?

    What about handling the failure in the application, and disabling and potentially resuming USB & MSC operation, without rebooting?

    Super User
    February 26, 2025

    How would I cut the power?

    Check the datasheet of your USB power switch: it can cut the output power automatically while providing the over-current signal. Toggle the OTG_FS_PSO signal to not active state, check if the overcurrent signal goes off. If it does, delay for few seconds and retry. If overcurrent signal stays active, there's a problem ((

     

     

    BMcDo.3Author
    Graduate II
    February 26, 2025

    I'd welcome any code examples handling this. I've been browsing around (e.g. in STM32CubeF4 and STSW-STM32138), but haven't found any yet.