你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

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

[复制链接]
mmuuss586 发布时间:2019-1-25 13:16
NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享)
6 K' h' U7 f2 ~, z: J$ }
基于ST官方NUCLEO-L053R8开发板
代码下载见附件
Stop mode without RTC:0.4uA VDD=3.0V
8 a2 P+ A; }' g- K
int main(void)
& N9 }2 n! C+ E- a6 {5 C. A{, f4 r2 w1 H2 w8 f
  /* STM32L0xx HAL library initialization:
4 K% x, h& [& R! d6 @       - Configure the Flash prefetch, Flash preread and Buffer caches( v9 H% O2 J7 x5 n% F
       - Systick timer is configured by default as source of time base, but user
8 i$ R, M/ F7 ~) }/ R             can eventually implement his proper time base source (a general purpose ( M+ A1 ?- m6 T# h* R- l
             timer for example or other time source), keeping in mind that Time base 9 w, Z. y, R; B% B, `
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
0 V4 P! j1 B1 f1 k             handled in milliseconds basis.
% f4 i0 K. i2 @6 n7 i       - Low Level Initialization6 w2 }8 N3 |  `+ V% t
     */
  _( h9 _; E; [  R6 Z8 J# T# _  HAL_Init();
' W0 U. F9 i4 p
* c" \8 j, Y9 m8 H* I$ Q' B  /* Configure LED2 */; M: x9 s* w* h5 \# m
  BSP_LED_Init(LED2);9 z  ^% `) M( t6 ^: A. O# t( w

# N# _7 F! B% I( p2 ^  /* Configure the system clock @ 32 Mhz */- J# w# `: B7 q( C& n  K& y
  SystemClock_Config();: e- N! _- S# e8 d, l2 V; N
  
" q! ?, `  ~8 O# w+ G/ u& r  /* Configure the system Power */
, e0 L$ U( U  H. d; u+ x! {7 s# [3 w  SystemPower_Config();/ M% x$ [! r# x/ V
0 A+ i6 L* a" z$ Q; y6 V$ g
  while (1)
& ~6 G+ W$ j! u; D: l  {7 F( w4 [0 o3 a0 y0 F& @1 X6 s, k
    /* Insert 5 second delay */
+ a% \. Q. U- l2 g- C8 t: v$ j8 vBSP_LED_Init(LED2);        //LED初始化 & l* G, F* Z2 ^
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED
1 C& i6 A; m2 g$ f2 Z7 {9 M& l8 `    HAL_Delay(3000);+ Z) l2 S( a, S8 |# `$ |$ g
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
. Q7 N" N/ G3 H    HAL_Delay(3000);& s6 l' i; m3 ]
SystemPower_Config();        //关闭所有IO和时钟2 `* Z& N( L$ J+ v/ p' o) O. F
    /* Key button (EXTI_Line13) will be used to wakeup the system from STOP mode */
- X& }% z2 L% [  n! `) k# c; ^    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);
/ b8 s9 q) f! v5 j. A. D2 c
! l( Z5 ^. A" N9 j3 z+ r    /* Enter Stop Mode */2 R; p, Y  h9 E* }7 X% e3 i
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
. i( N. ~% c5 G* }3 _6 v0 n2 {+ X4 ?8 x2 T6 C
    /* Configures system clock after wake-up from STOP: enable HSE, PLL and select
$ E% h* b& Y. |# c8 Y3 E+ Y    PLL as system clock source (HSE and PLL are disabled in STOP mode) */8 k7 f0 x' y$ ]
    SystemClockConfig_STOP();7 j  @* G1 e9 i5 i
  }- s9 m5 Y- j: p
}
3 e, z: ^5 K5 M% Q
1.png
2.png
3.jpg

# b& i; G- u4 V$ i1 N1 b0 C2 e8 B5 ]2 i
. ]# u+ ]& S! M. M5 @

PWR_STOP.rar

下载

4.01 MB, 下载次数: 45

收藏 评论18 发布时间:2019-1-25 13:16

举报

18个回答
mmuuss586 回答时间:2019-5-7 09:47:39
+ Z7 M1 a8 v# V& u) J9 W# \
感谢支持
generalcircuits 回答时间:2019-7-26 11:15:23
谢谢分享!参考学习
mmuuss586 回答时间:2019-7-27 11:32:59
谢楼上支持
mmuuss586 回答时间:2019-1-25 13:16:59
:)
Paderboy 回答时间:2019-1-25 13:50:32
多谢分享
mmuuss586 回答时间:2019-1-25 14:41:34
5 M, G1 G6 H- G& e& d1 }; N9 _3 ^! H
谢版主支持
Kevin_G 回答时间:2019-1-26 16:26:12
参考下
mmuuss586 回答时间:2019-1-27 10:09:56

' P: w, Y; D+ K& a/ n谢楼上支持
mmuuss586 回答时间:2019-2-3 20:11:56
拙夫 回答时间:2019-5-7 09:15:31
mmuuss586 回答时间:2019-6-18 12:45:36

, l: o9 @2 N' E- e6 B# O9 ?学习学习
mmuuss586 回答时间:2019-7-26 09:22:24
:D:D:D
mmuuss586 回答时间:2019-8-16 09:18:57
:D:D
mmuuss586 回答时间:2019-10-4 13:30:57
12下一页

所属标签

相似分享

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版