cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5A5: USB HS without XTAL oscillator - WORKS

tjaekel
Senior III

Struggling to get my own STM32U5A5 board working... the USB HS PHY was not working, until... (see below).

I was confused also with this thread:
https://community.st.com/t5/stm32-mcus-products/stm32u5-and-usb-hs/td-p/571774

This told me actually as well: you need an external XTAL, not a CMOS OSC (and maybe 16 MHz). - But not true.

I have changed my SystemClock_Config() !
Instead of an external 16 MHz XTAL (as on NUCLEO-U5A5ZJ-Q board) I have an external 8 MHz CMOS OSC (not a XTAL).
The USB CDC (VCP UART) project, running on NUCLEO board - runs now also on my own PCB! Cool.

Some other tweaks needed to reuse my NUCLEO-U5A5JZ-Q project (e.g. no UCPD1, no ADC VBUS sensing), but this SystemClock_Confing() did the job:

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;

#ifdef NUCLEO_BOARD

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

#else

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

#endif

RCC_OscInitStruct.HSIState = RCC_HSI_ON;

RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV1;

#ifdef NUCLEO_BOARD

//16 MHz XTAL, NUCLEO board

RCC_OscInitStruct.PLL.PLLM = 1;

RCC_OscInitStruct.PLL.PLLN = 20;

RCC_OscInitStruct.PLL.PLLP = 10; //32 MHz needed here!

RCC_OscInitStruct.PLL.PLLQ = 2;

RCC_OscInitStruct.PLL.PLLR = 2;

RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_1;

#else

//8 MHz OSC, my board

RCC_OscInitStruct.PLL.PLLM = 1; //2; ==> THIS FAILS on USB

RCC_OscInitStruct.PLL.PLLN = 40; //20; ==> THIS FAILS on USB

RCC_OscInitStruct.PLL.PLLP = 10;

RCC_OscInitStruct.PLL.PLLQ = 2;

RCC_OscInitStruct.PLL.PLLR = 2;

RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_1;

#endif

 

So, I can confirm: U5A5 works also with an 8 MHz CMOS OSC, instead of a XTAL (as mentioned in datasheet).
Just: not all possible combinations for PLL settings work, just one particular one.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Yes, for USB HS on a STM32U5A5 (the one with internal HS PHY) it "must" be external HSE. But not as mentioned just via a XTAL. It can be also a CMOS OSC chip (I use).

The confusion was on the statement in datasheet as:
"This interface requires a precise 60 MHz clock that is generated from the internal
USB PHY PLL (the clock source must use a HSE crystal oscillator)."

So, use HSE and enable HSE as clock source for the PLLs. And it works also with single-pin clock chip.

View solution in original post

5 REPLIES 5
tjaekel
Senior III
TDK
Guru

> RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

You're still using an external clock source. You didn't give the part number or I'd check but likely it's driven internally by a crystal. The STM32 doesn't know or care where the clock comes from, as long as it's sufficiently accurate. External oscillators can be plenty accurate here.

The linked post is saying HSI is not suitable for HS USB, which is accurate.

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

Yes, for USB HS on a STM32U5A5 (the one with internal HS PHY) it "must" be external HSE. But not as mentioned just via a XTAL. It can be also a CMOS OSC chip (I use).

The confusion was on the statement in datasheet as:
"This interface requires a precise 60 MHz clock that is generated from the internal
USB PHY PLL (the clock source must use a HSE crystal oscillator)."

So, use HSE and enable HSE as clock source for the PLLs. And it works also with single-pin clock chip.

Lukasz Nowak
Associate III

Yes, if you use an external oscillator, which meets the USB HS 100ppm tolerance requirements, everything is going to work fine. Btw such an oscillator will have a crystal inside.

The original discussion was about using the internal RC oscillators, which don't get better than maybe 1000ppm.

You also have to be careful not to use an external RC resonator - that would also not work for USB HS, as their tolerances are much higher than 100ppm.

Thank you.
The OSC I use (MC2520Z8.00000C19XSH) has a tolerance of 30ppm.
It looked to me the issue was the PLL setting:

  • with HSE enabled - the PLLM has to be 1 (not 2) and then PLLN and PLLP accordingly
  • with PLLM as 2 and even the other PLLN and PLLP settings are correct for the right frequency (PLLP for 16 MHz USB_PHY) it was not working (I played with the valid settings in CubeMX tool)