![]() PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART3 If (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2 RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV4 RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV4 ![]() RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2 RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2 RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK If (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE ** Initializes the CPU, AHB and APB busses clocks _HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE) ** Macro to configure the PLL clock source _HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW) I have commented the MX_RTC_Init() in the startup, so that RTC is not reset when the MCU restart.īelow are the code for system clock config, RTC Init, and the code to read the RTC registers after reset. Based on the documentation, this should automatically switch the RTC power source from VDD to VBAT. Next, I set the RTC in my code and then I disconnect the MCU from power source, and then reconnect it again. To do this I have connected a battery to the MCU. I am using a stm32h753 and stm32cubemx, and trying to run the RTC module on VBAT.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |