We’re using the Colibri IMX8X as the processing board for our embedded device. We have during some tests noticed that the overcurrent line of the regular USB connector does not seem to show up in the operating system. We’ve tried to manually trigger the flag but it did not seem to change anything.
Our device tree is mainly inspired by the Toradex reference design which also contains the Overcurrent flags on the USB gates. We also used the evaluation boards device tree as an inspiration of our own as such I was wondering if perhaps we’re missing some crucial settings to enable this overcurrent protection?
Dear @davygillebert ,
Thank you for writing to Toradex! Could you please tell us the output of
uname -a and also tell us, in which device tree file and how exactly did you try to " trigger the flag"?
I do fear uname -a will give little information taken it’s our own costume built
Linux colibri-imx8x 4.14.126-g1ca2bdd-dirty #12 SMP PREEMPT Mon Jun 8 08:09:07 CEST 2020
This built is made on top of:
I have tried manually pulling the flag low in hardware. We use the SP2526A to generate the flag but have not actually tested physically pulling to such current. The flag is active low. As such when pulling it to ground it should spark the overcurrent event.
The toradex_4.14-2.0.x-imx branch is deprecated and no longer supported. Please update to the latest toradex_4.14-2.3.x-imx branch at your earliest convenience. Please further note that -next branches are not officially supported.
Concerning the USB over-current signal: What exact behavior thereof would you expect? As far as I remember, none of our Embedded Linux BSPs ever did anything with it in software.
If the embedded Linux does nothing with that overcurrent flag line then why is it designed in? You would assume that the line would be used to cause an interrupt so that the user can be notified the USB just shut down due to overcurrent. Seems rather pointless to have such flag line go to the processor if it doesn’t contribute to anything, or am I missing a point here?
From another source:
"Linux will report a short circuit if the USB transceiver hardware reports that condition to Linux. See source/drivers/usb/core/hub.c:port_event(). In this case Linux avoids sending data to the port for 0.1 to 0.5s in order to give a short-term even time to dissipate and disables the port if the over-current condition persists. "
Unfortunately, the BSP doesn’t do anything with the OC flag information. It seems that there is not even an interface where you can ask for this information. However, if you need the OC information you can configure the according pin as GPIO4_6 and read the pin status via GPIO interface.
The USB specification doesn’t clearly say what to do in an over current situation. If your power supply has trouble with over current, then you need to power down the power supply immediately without involving the software at all.