打印
[STM32F0]

STM32F030 如何进入STANDBY模式

[复制链接]
3375|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
usbyt|  楼主 | 2016-3-10 22:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
STM32F030 如何进入STANDBY模式,有没有完整demo代码可以测试?
沙发
airwill| | 2016-3-11 08:03 | 只看该作者
进入低功耗模式 对于所有的 STM32 单片机都一样, 执行 WFE/WFI 指令.
进入STANDBY模式或其它模式的区别在于, PDDS和LPDS位,SLEEPDEEP位的设置.

使用特权

评论回复
板凳
usbyt|  楼主 | 2016-3-11 10:37 | 只看该作者
有没有demo程序跑跑,按照stm32foxx standby peripherals library里面 pwr的说法,跑不动

使用特权

评论回复
地板
usbyt|  楼主 | 2016-3-11 10:38 | 只看该作者
int main(void)
00059 {
00060   /*!< At this stage the microcontroller clock setting is already configured,
00061        this is done through SystemInit() function which is called from startup
00062        file (startup_stm32f0xx.s) before to branch to application main.
00063        To reconfigure the default setting of SystemInit() function, refer to
00064        system_stm32f0xx.c file
00065      */
00066      
00067   /* Configure LED3 */
00068   STM_EVAL_LEDInit(LED3);
00069   
00070   /* Configure Systick */
00071   SysTick_Configuration();
00072   
00073   /* Turn ON LED3 */
00074   STM_EVAL_LEDOn(LED3);  
00075
00076   /* Configures Tamper button */
00077   STM_EVAL_PBInit(BUTTON_TAMPER,BUTTON_MODE_GPIO);
00078                  
00079   /* Configure RTC clock source and prescaler */
00080   RTC_Config();
00081
00082   /* Wait till Tamper button is pressed */  
00083   while(STM_EVAL_PBGetState(BUTTON_TAMPER) != RESET);
00084
00085   /* Enter STANDBY mode, RTC Alarm within 3 second or an external RESET will
00086    wake-up the system from STANDBY */
00087   EnterSTANDBYMode();
00088   
00089   while(1)
00090   {}
00091 }





static void RTC_Config(void)
00099 {  
00100   RTC_InitTypeDef   RTC_InitStructure;
00101   RTC_TimeTypeDef   RTC_TimeStructure;
00102   uint32_t LSIFreq = 0;
00103
00104   /* Enable the PWR clock */
00105   RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
00106   
00107   /* Allow access to Backup Domain */
00108   PWR_BackupAccessCmd(ENABLE);
00109   
00110   /* Disable wake-up source(ALARM) to guarantee free access to WUT level-OR input */
00111   RTC_ITConfig(RTC_IT_ALRA, DISABLE);
00112
00113   /* Clear Wakeup flag */
00114   PWR_ClearFlag(PWR_FLAG_WU);
00115
00116   /* Enable wake-up source(ALARM) to guarantee free access to WUT level-OR input */
00117   RTC_ITConfig(RTC_IT_ALRA, ENABLE);
00118   
00119   /* Enable the LSI OSC */
00120   RCC_LSICmd(ENABLE);
00121   
00122   /* Wait till LSI is ready */
00123   while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
00124   {}


会停在红色部分

使用特权

评论回复
5
usbyt|  楼主 | 2016-3-11 10:43 | 只看该作者
停在  123行
while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

81

帖子

0

粉丝