首页 论坛 原厂专区 ST MCU NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享)

发帖 回复

[分享] NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享)
3050 查看
29 回复
 楼主 | 发布于 2019-01-25 | 只看楼主
分享到:

NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享)

基于ST官方NUCLEO-L053R8开发板

代码下载:见附件

Stop mode without RTC:0.4uA VDD=3.0V

int main(void)
{
  /* STM32L0xx HAL library initialization:
       - Configure the Flash prefetch, Flash preread and Buffer caches
       - Systick timer is configured by default as source of time base, but user 
             can eventually implement his proper time base source (a general purpose 
             timer for example or other time source), keeping in mind that Time base 
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
             handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure LED2 */
  BSP_LED_Init(LED2);

  /* Configure the system clock @ 32 Mhz */
  SystemClock_Config();
  
  /* Configure the system Power */
  SystemPower_Config();

  while (1)
  {
    /* Insert 5 second delay */
BSP_LED_Init(LED2); //LED初始化 
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); //点亮LED,延时3S,再灭LED
    HAL_Delay(3000);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
    HAL_Delay(3000);
SystemPower_Config(); //关闭所有IO和时钟
    /* Key button (EXTI_Line13) will be used to wakeup the system from STOP mode */
    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);

    /* Enter Stop Mode */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    /* 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) */
    SystemClockConfig_STOP();
  }
}



本帖有更多资源,需 登录 才可以下载,没有帐号?立即 注册

(0 ) (0 )
回复 举报

楼主 | 回复于 2019-01-25 沙发

(0 )
评论 (0) 举报

楼主 | 回复于 2019-01-25 2#

例程已更新
(0 )
评论 (0) 举报

回复于 2019-01-26 3#

谢谢分享
(0 )
评论 (0) 举报

回复于 2019-01-28 4#

感谢
(0 )
评论 (0) 举报

回复于 2019-01-28 5#

感谢分享
(0 )
评论 (0) 举报

回复于 2019-01-28 6#

感谢分享!!!
(0 )
评论 (0) 举报

回复于 2019-01-28 7#

感谢分享!!!
(0 )
评论 (0) 举报

回复于 2019-01-28 8#

感谢分享!!!
(0 )
评论 (0) 举报

回复于 2019-01-28 9#

支持一下,需要机器人方案的。硬件电路设计,软件编程,APP开发。机械臂非标自动化设计的,欢迎关注我,相互学习,共同进步,请联系我!
(0 )
评论 (0) 举报

回复于 2019-01-30 10#

谢谢分享!!!
(0 )
评论 (0) 举报
发表回复
0/3000





举报

请选择举报类别

  • 广告垃圾
  • 违规内容
  • 恶意灌水
  • 重复发帖

全部板块

返回顶部