我目前用
STM32F030K6测试stop mode功能,没有外接任何OSC(HSE, LSE)
跳出方式是使用EX
ti的方式来离开stop mode
ST example code有类似的功能,但都是用LSE当stop mode时的时钟、并且有增加RTC来唤醒stop mode
请问我以下的写法正确吗?
- /* Enable the PWR clock */
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
- /* Allow access to RTC */
- PWR_BackupAccessCmd(ENABLE);
- /* Reset back up registers */
- RCC_BackupResetCmd(ENABLE);
- RCC_BackupResetCmd(DISABLE);
- /* Enable the LSI OSC */
- RCC_LSICmd(ENABLE);
- /* Wait till LSI is ready */
- while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
- {}
- /* Request to enter STOP mode with regulator in low power mode */
- PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
当跳出stop mode后,范列码內有加上以下function
- /* Configures system clock after wake-up from STOP */
- SYSCLKConfig_STOP();
- static void SYSCLKConfig_STOP(void)
- {
- /* After wake-up from STOP reconfigure the system clock */
- /* Enable HSE */
- RCC_HSEConfig(RCC_HSE_ON);
- /* Wait till HSE is ready */
- while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET)
- {}
- /* Enable PLL */
- RCC_PLLCmd(ENABLE);
- /* Wait till PLL is ready */
- while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
- {}
- /* Select PLL as system clock source */
- RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
- /* Wait till PLL is used as system clock source */
- while (RCC_GetSYSCLKSource() != 0x08)
- {}
- }
请问我要回到原本用HSI当时钟的设定要如何修改呢?
谢谢