[STM32L0]

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

[复制链接]
1023|10
手机看帖
扫描二维码
随时随地手机跟帖
mmuuss586|  楼主 | 2019-1-25 13:14 | 显示全部楼层 |阅读模式
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();
  }
}

1.png
2.png
3.jpg


PWR_STOP.rar

4.01 MB

mmuuss586|  楼主 | 2019-1-25 13:15 | 显示全部楼层

使用特权

评论回复
slotg| | 2019-1-25 14:27 | 显示全部楼层
感谢分享

使用特权

评论回复
mmuuss586|  楼主 | 2019-1-25 16:32 | 显示全部楼层

谢楼上支持

使用特权

评论回复
mmuuss586|  楼主 | 2019-2-3 20:04 | 显示全部楼层

使用特权

评论回复
磨砂| | 2019-3-1 12:44 | 显示全部楼层
呵呵呵  版主发的帖子果然很有技术含量

使用特权

评论回复
mmuuss586|  楼主 | 2019-3-1 13:01 | 显示全部楼层
谢楼上支持;

使用特权

评论回复
mmuuss586|  楼主 | 2019-10-20 14:41 | 显示全部楼层

使用特权

评论回复
lihongkun898| | 2019-11-19 10:53 | 显示全部楼层
谢谢

使用特权

评论回复
mmuuss586|  楼主 | 2019-11-20 10:28 | 显示全部楼层

使用特权

评论回复
mmuuss586|  楼主 | 2020-1-20 09:51 | 显示全部楼层

使用特权

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

本版积分规则

个人签名:欢迎进入21IC论坛 游名科技:提供直流无刷电机驱动整体解决方案

695

主题

32587

帖子

436

粉丝