BUGFIX: startup issue with LSE crystal

This commit is contained in:
Robin Dietzel 2023-01-24 15:45:45 +01:00
parent 2b86372619
commit b3b2f9ba48
3 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,6 @@
// Auto generated header file containing the last git revision
#define GIT_HASH "57ae289"
#define GIT_HASH "408c69b"
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H

View File

@ -127,7 +127,7 @@ int main(void) {
//Step 3: Configure Peripherals
MX_GPIO_Init();
MX_RTC_Init();
//MX_RTC_Init();
MX_TIM2_Init();
MX_USB_DEVICE_Init();
MX_ADC1_Init();
@ -402,9 +402,9 @@ void SystemClock_Config(void) {
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 12;
@ -701,6 +701,8 @@ void Error_Handler(void) {
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
MX_GPIO_Init();
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);
while (1) {
}
/* USER CODE END Error_Handler_Debug */

View File

@ -224,7 +224,7 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
/** Initializes the peripherals clock
*/
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();