stm32: Add compile-time option to use HSI as clock source.
To use HSI instead of HSE define MICROPY_HW_CLK_USE_HSI as 1 in the board configuration file. The default is to use HSE. HSI has been made the default for the NUCLEO_F401RE board to serve as an example, and because early revisions of this board need a hardware modification to get HSE working.
This commit is contained in:
committed by
Damien George
parent
e61862d063
commit
f938e70c69
@@ -329,13 +329,16 @@ STATIC void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {
|
||||
/* Reset SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
|
||||
|
||||
/* Configures system clock after wake-up from STOP: enable HSE, PLL and select
|
||||
PLL as system clock source (HSE and PLL are disabled in STOP mode) */
|
||||
/* Configures system clock after wake-up from STOP: enable HSE/HSI, PLL and select
|
||||
PLL as system clock source (HSE/HSI and PLL are disabled in STOP mode) */
|
||||
|
||||
__HAL_RCC_HSE_CONFIG(MICROPY_HW_CLK_HSE_STATE);
|
||||
__HAL_RCC_HSE_CONFIG(MICROPY_HW_RCC_HSE_STATE);
|
||||
#if MICROPY_HW_CLK_USE_HSI
|
||||
__HAL_RCC_HSI_ENABLE();
|
||||
#endif
|
||||
|
||||
/* Wait till HSE is ready */
|
||||
while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET)
|
||||
/* Wait till HSE/HSI is ready */
|
||||
while(__HAL_RCC_GET_FLAG(MICROPY_HW_RCC_FLAG_HSxRDY) == RESET)
|
||||
{}
|
||||
|
||||
/* Enable the main PLL. */
|
||||
|
||||
Reference in New Issue
Block a user