cancel
Showing results for 
Search instead for 
Did you mean: 

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

BMcDo.3
Associate III

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

 

6 REPLIES 6
TDK
Guru

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

If you feel a post has answered your question, please click "Accept as Solution".
BMcDo.3
Associate III

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?

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 ((

 

 

Depends how you're powering it. If you're using STMPS2141STR, pulling the EN line low will work.

> Does the STMPS2141STR not protect itself and recover sufficiently without this?

Most LDOs and drivers have overcurrent protection, but the spec says you have to cut power, so you have to cut power.

> what section?

Download the largest USB spec PDF and search for "OVER_CURRENT".

 

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

Pretty sure the spec calls out the recovery steps. Waiting 1 second and retying seems fine. If overcurrent still exists, maybe cut power until a power cycle.

If you feel a post has answered your question, please click "Accept as Solution".
BMcDo.3
Associate III

@TDK wrote:

 

...

> what section?

Download the largest USB spec PDF and search for "OVER_CURRENT".

The only instances of "OVER_CURRENT" I see in usb_20_20240927/usb_20.pdf are Chapter 11, "Hub Specification". I think that would not apply to a USB host such as mine, right? Am I looking in the wrong place? Or did you misremember something?


@Pavel A. wrote:

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 ((


OK, my read of the STMPS2141 datasheet (sections 3.2 Overcurrent/overtemperature protection - 3.3 Fault conditions) is that during the overcurrent condition, it only reduces voltage (doesn't turn off, like when overheating), so I guess I should do something like you suggest to control the power switch when that happens...