[FL-635] Enable LSE CSS (#371)
* LSE CSS: explicitly configure and start LSE + LSI1 and enable LSECSS at boot, enable LSECSS interrupt in firmware. * F4: backport LSE CSS shenanigans. * Split LSE/HSE CSS handling routines, add TODO for missing notification.
This commit is contained in:
@@ -73,11 +73,12 @@ void SystemClock_Config(void)
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
LL_RCC_HSE_SetCapacitorTuning(0x18);
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE
|
||||
|RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE
|
||||
| RCC_OSCILLATORTYPE_LSI1 | RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
@@ -127,9 +128,11 @@ void SystemClock_Config(void)
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
// Enable CSS for both clocks
|
||||
// CSS for HSE
|
||||
HAL_RCC_EnableCSS();
|
||||
// CSS for LSE
|
||||
HAL_RCCEx_EnableLSECSS();
|
||||
HAL_RCCEx_EnableLSECSS_IT();
|
||||
}
|
||||
|
||||
void Error_Handler(void) {
|
||||
|
Reference in New Issue
Block a user