2020-05-24 05:40 AM
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.
2020-05-24 08:37 AM
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.
2020-05-26 01:57 PM
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.