Question
Question about LL CRS initialization generated by MX (USB L4+ or G4)
Cube MX generate the following code:
LL_CRS_SetSyncDivider(LL_CRS_SYNC_DIV_1);
LL_CRS_SetSyncPolarity(LL_CRS_SYNC_POLARITY_RISING);
LL_CRS_SetSyncSignalSource(LL_CRS_SYNC_SOURCE_USB);
LL_CRS_SetReloadCounter(__LL_CRS_CALC_CALCULATE_RELOADVALUE(48000000,1000));
LL_CRS_SetFreqErrorLimit(34);
LL_CRS_SetHSI48SmoothTrimming(64);In this code the CRS clock is not initialized and the CRS is not enabled. I can't find these actions elsewhere in the code.
If HAL is used, the CRS clock is started and the CRS is enabled
So I use this code
LL_APB1_GRP1_EnableClock (LL_APB1_GRP1_PERIPH_CRS) ;
LL_CRS_SetSyncDivider(LL_CRS_SYNC_DIV_1);
LL_CRS_SetSyncPolarity(LL_CRS_SYNC_POLARITY_RISING);
LL_CRS_SetSyncSignalSource(LL_CRS_SYNC_SOURCE_USB);
LL_CRS_SetReloadCounter(__LL_CRS_CALC_CALCULATE_RELOADVALUE(48000000,1000));
LL_CRS_SetFreqErrorLimit(34);
LL_CRS_SetHSI48SmoothTrimming(64);
LL_CRS_EnableAutoTrimming () ;
LL_CRS_EnableFreqErrorCounter () ;Is this what CubeMX should generate?
Tested with G431 and L4R5
