cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-U5A5ZJ-Q - USB port configured as host

mikiserf
Associate II

Hi everyone. I have a problem with my U5A5ZJ-Q core board. The mounted microcontroller is STM32U5A5ZJT6QU. The project is to drive a QUECTEL em05 LTE modem. I need to configure the USB port exposed by PA11 and PA12 in Host mode. I am using the standard Host libraries in Middlewares and also the files in the USB_Host folder. I am trying to configure everything without success. I can't find exact written procedures to do this. Has anyone had problems? Has anyone tried? The problem is with the initialization of the USB Host port. It remains in reset mode and the CSRST bit never returns to 0. Below is a portion of the serial log that I printed on the monitor. " [CLK] Enabling HSI48...<CR><LF>
[CLK] HSI48 RDY=1<CR><LF>
[CLK] CLK48 <- HSI48 (via __HAL_RCC_CLK48_CONFIG)<CR><LF>
[USBH] Init...<CR><LF>
[LL] USBH_LL_Init (FS)<CR><LF>
[HCD] Enter HAL_HCD_Init<CR><LF>
[MSP] AFRH(GPIOA)=0x000AA770 AF_PA11=10 AF_PA12=10<CR><LF>
[MSP] GCCFG=0x02010000 GUSBCFG=0x00001400<CR><LF>
[HCD][PRE] GUSBCFG=0x00001400 GCCFG=0x00000000 GRSTCTL=0x80000000<CR><LF>
[HCD] Call USB_CoreInit<CR><LF>
[LL] USB_CoreInit (v6: FS-PHY pre-CSRST ON) enter<CR><LF>
[LL][DBG] pre-CSRST: GUSBCFG=0x00002800 GCCFG=0x02010000 GAHBCFG=0x00000000 GRSTCTL=0x80000000 GINTSTS=0x04000020<CR><LF>
[LL][ERR] CSRST timeout GRSTCTL=0x80000001<CR><LF>
[HCD][ERR] USB_CoreInit FAIL<CR><LF>
[LL] HAL_HCD_Init FAIL (FS)<CR><LF>
[USBH] USBH_Init OK (HOST_HS)<CR><LF>
[USBH] CDC class registered<CR><LF>
[USBH] Host started<CR><LF>
SYSCLK = 80000000 Hz<CR><LF>" I'm powering USB directly. Can anyone help me? Any advice or procedure? Has anyone used a different microcontroller that successfully implemented USB Host and perhaps driven an LTE modem? Thanks a lot.

2 REPLIES 2
SamMiddleton
Associate II

What exactly do you mean "I'm powering USB directly"?

A USB Host is responsible for providing VBUS, but the NUCLEO boards aren't set up to do so by default.
I was able to get a NUCLEO-U545RE-Q to act as a USB Host by back-feeding VBUS through the "USB USER" jumper on the 5V_SEL header JP3 ("STLK" was also connected as the actual source of 5V).

On the NUCLEO-144 boards, the 5V selection header is JP6, and the position for the user USB port is labeled "5V_USB_C"

Hope this helps!

mikiserf
Associate II

Maybe I didn't express myself correctly. In the NUCLEO in question, the USB Host port is not on the circuit. If you therefore need a USB Host port, you must use an external connector where D+ and D- are PA11 and PA12. Power to the host port is generally controlled by the board which drives a power switch via a GPIO. The board then controls it with vsens. Through internal registers, you can decide in configuration whether to disable this function. In that case, you bring the 5V to the host port directly without driving the GPIO. This is my case. But that's not the problem. The problem is that there is no guide, reference, or example to help you configure the USB Host HS port in FS. Bit 1 of GRSTCTL=0x80000001 is always set. If it remains set, the Host port does not work. If it is set, the Host port doesn't work. I'm stuck here and I don't think I can do it. I think I'll migrate to another microcontroller.