cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 crystal less usb

rzong.1
Associate II

I want to synchronize the cpu clock frequency with the SOF frequency of USB.

datasheet says, that you may use HSI48 for crystal less operation or use an XTAL.

Question is: Is HSI48 synchron with the SOF frequency?

(than I could use MCO out as reference clock)

second question:

in CubeMX I can configure HSI16 to generate the 48 MHz USB clock. Will that work? CubeMX generated no warning.

2 REPLIES 2
TDK
Guru

From the datasheet:

> It requires a precise 48 MHz clock which can be generated from the internal main PLL (the clock source must use a HSE crystal oscillator) or by the internal 48 MHz oscillator in automatic trimming mode.

So yes, provided you enable the automatic trimming mode as follows:

__HAL_RCC_CRS_CLK_ENABLE();
SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN);
SET_BIT(CRS->CR, CRS_CR_CEN);

These commands are for the H7 series. I imagine the G4 series is similar but I didn't check.

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

Hi,

so after reading the manuals, I found out, that HSI48 with the trimming mechanism is not synchronuos with the SOF frequency. This is because the synchronisation mechanism is not a PLL.

So my problem is not solved.

But thanks for Your hint.