Showing results for 
Search instead for 
Did you mean: 

Why STM32H747i USB host so unstable with reg OTG_HS_HPRT change from 0x1005 to 0x1401 ?

Associate II

I bought a STM32H747i-DISCO board to learning USB HOST to drive a camera, I found the usb host is very unstable, every is fine except suddenly dropout which meanings the port disabled, I debug and struggle for months with no nothing solved. the USB HOST2.0+ULPY program used freeRTOS V10.3.1 with TouchGFX 17.0, I believe two of them has no side effects with usb host problem what I found is:

  1. problem 1: few second or few minutes after reset board, usb suddenly dropout, the value of reg HRPT(0x40040440) change from normal 0x1005(good) to 0x1401(bad), which means PENA change from 1 to 0, so USBH_LL_PortDisabled() is called, although it is not disconnect but actually it do is! the data tranfer stopped and there is no SOF frame from now.
  2. problem 2: can't enumerate or do class request before camera is ready to use, the reason is CTRL TRANSFER can't succeed, I do very hard debug and even modify usbh_core.c and usbh_ctrreq.c and has_hcd.c to find what happend, I believe the LIB's bug is not much except not tune with ISC transfer, It seems a hardware problem.
  3. if prombem 1 happen, I can't reconnect usb device anymore by software, even if I reset HOST core... I have changed all delay, add some delay, modify USB HOST lib, useless.
  4. to solve problem 2,I use oscilloscope found sometimes D+ and D- line's Vol Voltage is little high, normally it should be less than 0.4V, why ths happen? I have no idea. another thing , I read usb3320 datasheet and found that the capacitance of VUBS should be 120uF, so I change the cap from 10uF to 120uf, and add 1uF+0.1uF to camera side,The situation is a little better.
  5. at last I use a notebook PC's usb port to power the DISCO board, and another usb port to connect STLINKV3, I found the fact: when STLINKV3 is NOT connected, usb dropout is GONE!

why? what I missed?

Principal III

at first i would assume a problem with the power supply.

feed the DISCO board with some 5V from a standard 5V 3A charger or other stable 5V source - and see.

set jumpers as needed and connect charger to mains as last connection (to avoid the charging capacitive from mains->charger to kill something, USB ports dont like charge, when plugged in...)

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

thank Ascha.3 for your precious experience, I remember I use a DC linear power supply to power DISCO, and change the DC output to standard 5V(usb port of PC normally about 4.7V), jumps also changed to select power source, Its hard to say things changed better, and I also use a mobile charger 4.6V/5A, sometime good but have limit effect. the more effect come from change VBUS cap from 10uF(for device) to 120uF(for host). after do many test, I choose use two USB port, one for STLINK V3, one for power the usb3320 phy, I guess it is a hardware bug, I don't know it comes from usb3320 or stm32h7, can't reconnet is really hard to design any good fault tolerant product.

Principal III

>> when STLINKV3 is NOT connected, usb dropout is GONE!<<

is quite obvious indicating : STLINK V3 is creating some problem, only 2 reason are there:

  • it is disturbing the software, maybe some debug/breakpoint action
  • its disturbing the VCC+ (or GND) , by its power consumption or spikes

so more low impedance (ceramic) caps close to board (i would try some 10uF X7R SMD caps), maybe also on usb3320 vcc close to chip. and a good 5V source of course.

and good ground connection is also mandatory, >200mV spikes can introduce errors; so try to avoid ground loops also (maybe test: just disconnect STLINK V3 GND wire)

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

thank AScha.3, Yes, your hint is quite helpfull for me, I have observed that power ripple make usb dropout by oscilloscope in single trigger mode, when the ripple suddenly rise up to trigger a snapshot, the usb connection dropout immediately, this is obviously a evidence, but only once to observed that, so I still believe there must be some reason else. I totally agree with STLINK V3 debug action may the main cause of faut, but I have no evidence right now, the STLINK V3 is Integrated on DISCO, so I cannot disconnect GND loop right now, I'll make some test in future.