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

NUCLEO-L053R8:低功耗待机模式standby/RTC唤醒(例程分享)

[复制链接]
mmuuss586 发布时间:2019-1-25 17:03
NUCLEO-L053R8:低功耗待机模式standby/RTC唤醒(例程分享)
2 D; B  O' V" A( T2 E! C, P
待机模式唤醒后等同复位
基于ST官方NUCLEO-L053R8开发板
用RTC唤醒,实际效果是LED一直在闪
代码下载:见附件
standby mode with RTC:0.85uA VDD=3.0V
/**
& o3 h% z" A1 T/ c3 f* @brief  Main program; D( [8 [7 @% v
* @param  None
& f' R6 m- x) a9 @! ^$ f# r* @retval None
# B3 Q. q/ u6 r' ?*/
* t7 ~4 x; j. oint main(void)
+ H  D8 z2 H# d{  
) f( R; M/ x* C  /* STM32L0xx HAL library initialization:; I0 j4 x7 i# h4 n; e# C# P
       - Configure the Flash prefetch, Flash preread and Buffer caches! Y1 D" \& U# g% j6 r4 S
       - Systick timer is configured by default as source of time base, but user 3 j5 E9 L7 O6 ]# E
             can eventually implement his proper time base source (a general purpose 9 W) C2 D. k, D! N
             timer for example or other time source), keeping in mind that Time base 0 y9 D2 t: N! q4 ~; k- t/ H
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and - J! ?% H' k1 ?( }" D. I
             handled in milliseconds basis.
  k) N: T) J* Y" r4 u8 y3 I       - Low Level Initialization5 {7 U; i- c4 r8 T4 u, c4 o- M! Z
     */- c4 ~+ q. A7 h. K& Z$ d
  HAL_Init();
2 {/ Q, K3 c% C  C3 ^1 I) v  /* Configure LED2 */
" }. W! K9 v; f5 Z$ G0 V2 q  BSP_LED_Init(LED2);
/ M; k6 u) X: l* ~( L9 {$ S  /* Configure the system clock to 2 MHz */
- j/ j  h  F$ N  SystemClock_Config();+ q$ e' v: b: G$ |$ r, u
9 ^5 W; N+ V9 ^
  /* Check and handle if the system was resumed from Standby mode */
0 [: y+ Q( @% R* `  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)% G3 Q! m! P+ J  ]- e8 \- Y( b
  {% X1 G2 M% h( I' v4 E: X& J
    /* Clear Standby flag */) b" A8 u. t3 q' y3 L( f
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);! |6 J. {+ Z! f& E. c! ]4 J3 G- h
//如果是唤醒状态,则LED亮3秒
& ~+ h; d8 b  G" m2 g+ N# YHAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED2 M/ m3 x3 f( ?' ?+ M
HAL_Delay(3000);
9 P" P: w" w! b# A9 q2 dHAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);7 {. k* n; Z* V/ {" M$ K- d; w& p1 j
  }/ R7 f4 Z! q4 ]2 N$ k7 d* u
else;, U. y3 C# h% F) g
  % X! x* H1 j' W! C
/* Configure the system Power */
8 ]4 t  s5 z% {9 e' t  SystemPower_Config();
! T8 q- G1 P, L; \. v  7 i* {; ~8 j: b8 t/ i7 D. s1 K, j
  /* Insert 1 seconds delay */& }* h3 ]) w+ ]
  HAL_Delay(1000);
& E7 k3 M3 ^8 X9 U# a, f; f. r' ?3 }0 x    /*The Following Wakeup sequence is highly recommended prior to each Standby mode entry
1 G3 p! ?1 ?6 H/ J) f     mainly  when using more than one wakeup source this is to not miss any wakeup event./ b% b1 d% Q' C
       - Disable all used wakeup sources,
% \5 d% @! k, g& j' D# T       - Clear all related wakeup flags, 6 K8 y4 _& i$ e( u$ M: |
       - Re-enable all used wakeup sources,
7 _/ B, E3 Y9 T* r0 Q" {0 B       - Enter the Standby mode.
0 n  k4 R4 B; A5 i3 Z     */
3 H0 Z2 B  @. _( f! e  /*Disable all used wakeup sources: Pin1(PA.0)*/
+ Z2 t5 r* t( Q* {  b- ]  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
" `% G1 {! A5 e/ y  ?2 |$ n: d4 }  
" Y, k$ B5 B3 _! U% y  /*Clear all related wakeup flags*/
( J& Q2 a& s( l! N/ f  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
& |* x6 g7 K8 A  
! S% c6 Y: V( n  /*Re-enable all used wakeup sources: Pin1(PA.0)*/
" }4 v/ C7 D& @' O1 F8 Q. G& Y  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);+ Q8 W( k& F& p! N6 t6 C) B1 l
  
5 o/ j9 J  a) z5 Y1 g: F$ @1 w% y& j  /*Enter the Standby mode*/5 [  E1 g9 [4 u" p4 X
  HAL_PWR_EnterSTANDBYMode();
9 W" I  @: K" e" |2 a  9 _" ^7 ^" \. i
  while (1)
) M9 Z% _1 Z' X  {
# u# u4 o0 g3 f; `7 w4 l# t6 s  }0 E  K$ E; Q# e& k: ?+ r* E6 O
}
1.png
2.png
3.jpg

9 t: y  y' `+ J+ W, i" R. S

PWR_STANDBY_RTC.rar

下载

4.02 MB, 下载次数: 66

赞 收藏 1 评论19 发布时间:2019-1-25 17:03

举报

19个回答
generalcircuits 回答时间:2019-8-1 15:44:48
支持一下,原创不容易,楼主这么辛苦
justmei 回答时间:2019-3-16 21:52:45
你这个是pin唤醒不是RTC唤醒。。
mmuuss586 回答时间:2019-8-4 13:31:19

% c, ]+ Y/ U9 }谢楼上支持
mmuuss586 回答时间:2019-1-25 17:04:20
Kevin_G 回答时间:2019-1-26 09:19:24
还可以
mmuuss586 回答时间:2019-1-26 10:30:48
谢楼上支持
mmuuss586 回答时间:2019-2-3 20:14:14
mmuuss586 回答时间:2019-3-18 09:46:33

7 i/ m' x9 X7 F( o谢楼上支持
mmuuss586 回答时间:2019-6-18 12:47:09

% b" t7 T9 @' I  R7 R: B学习学习
mmuuss586 回答时间:2019-7-26 09:23:27
:D:D:D
mmuuss586 回答时间:2019-8-1 09:28:25
:D
mmuuss586 回答时间:2019-8-1 09:28:42
:D:D:D
mmuuss586 回答时间:2019-8-16 09:25:56
:D:D:D
mmuuss586 回答时间:2019-10-4 13:33:01
12下一页
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版