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

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

[复制链接]
mmuuss586 发布时间:2019-1-25 17:03
NUCLEO-L053R8:低功耗待机模式standby/RTC唤醒(例程分享)
$ K! a& ]6 a: {8 i; G+ l
待机模式唤醒后等同复位
基于ST官方NUCLEO-L053R8开发板
用RTC唤醒,实际效果是LED一直在闪
代码下载:见附件
standby mode with RTC:0.85uA VDD=3.0V
/**9 u* g$ l7 a* M# y; i
* @brief  Main program
' V& V' B/ s  Z) X* @param  None
5 ]$ p+ W! M3 s$ _9 j* @retval None
) K8 z0 d- w- H*/
: B! ]7 K" f/ B/ _" V( n4 Gint main(void)
4 r! R( o' O1 f+ }% V' f{  7 p8 q: ~5 T9 V# B% C) g( |
  /* STM32L0xx HAL library initialization:
& p1 l3 f+ O8 h1 G! k2 t7 P       - Configure the Flash prefetch, Flash preread and Buffer caches
" M. F) W$ j# Z% o0 I       - Systick timer is configured by default as source of time base, but user
" S3 J- j: p8 {1 G$ S             can eventually implement his proper time base source (a general purpose 1 ~: J% Q/ y5 B- O7 P3 l- k4 G: q. K
             timer for example or other time source), keeping in mind that Time base
6 k8 z7 u0 P& m" M6 z! [! K             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and ) |9 X( B+ V3 {$ m5 L# U
             handled in milliseconds basis.8 i5 b* T' ?8 J3 D# b  w5 H1 Q7 x- W/ w
       - Low Level Initialization& k+ K8 X1 g& v% P
     */, \5 J" _- W$ b
  HAL_Init();
4 _5 v, H* P' q  /* Configure LED2 */
. F/ S7 I" z, `" g0 k7 e' H  BSP_LED_Init(LED2);7 K; B4 O% G' u' t
  /* Configure the system clock to 2 MHz */
, ~) ~: E3 r% L# C; q  SystemClock_Config();
  b; y# O! P/ C
' E7 ^, }0 D1 P' f2 T  /* Check and handle if the system was resumed from Standby mode */
) U; Z/ K3 ?( G( `  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
0 n# b) f# x( K. @; m  {) a! U' d' b. D' O( Z
    /* Clear Standby flag */, L) g# d! C3 x2 m
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);5 U1 m) `3 F$ m9 c8 X
//如果是唤醒状态,则LED亮3秒
7 W" X1 O* x9 e8 M" jHAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED
, G( G5 |9 ^  S6 PHAL_Delay(3000);% ]! O4 }: y* a! f2 z3 T$ X
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
3 T9 u6 R+ R8 V, Y& C- e" ^9 T  }
, @. z5 n  ]  p- ^" H! uelse;7 \; E) v4 u9 M! u- d3 y# d
  2 z" h4 T- S1 R4 t, w# p7 V
/* Configure the system Power */3 s8 h3 f% E! v5 R; k% Q
  SystemPower_Config();
  M' ?3 Z* C3 y+ k  
0 ?( c# h4 [2 E: M+ V0 M( X' Q  /* Insert 1 seconds delay */
/ l: U& F* e( m( T/ \; J6 V  HAL_Delay(1000);9 m8 S2 a+ P  D& l" A9 u2 z- i
    /*The Following Wakeup sequence is highly recommended prior to each Standby mode entry
0 x' u. m! T0 c' f* t! k( o8 l9 N5 F     mainly  when using more than one wakeup source this is to not miss any wakeup event.
/ y' l1 \$ l+ [) X       - Disable all used wakeup sources,
$ p+ N/ @, I- g; ?5 ?. L6 G       - Clear all related wakeup flags, ; G3 ^" H" F1 m) y5 y( _
       - Re-enable all used wakeup sources,
+ n- E+ y8 k* Y& R7 ^0 s3 S+ z0 f       - Enter the Standby mode.& J! q4 g  g0 _8 r- e7 ]
     */
+ x2 U8 a0 _& g! P+ C+ F  /*Disable all used wakeup sources: Pin1(PA.0)*/& }( g  U4 t' b
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
( o" u9 m; @! L1 j7 E$ P  
. u; c$ S' ?$ q! u  /*Clear all related wakeup flags*/  C& K7 w7 M! ~" N: z" c( g" V
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
, p& T2 _2 `6 h$ F) Q, s4 z  
# D2 g' N( o1 P" Y0 I# S  /*Re-enable all used wakeup sources: Pin1(PA.0)*/
6 W. ^5 _4 |* a  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);. k. ]! ], q( {7 Y; `! S. u
  
& w, n8 b5 }. j# X+ H& \  /*Enter the Standby mode*/: M8 d6 o4 n4 P* u0 W( I. S
  HAL_PWR_EnterSTANDBYMode();
+ L2 v; {  f6 C6 Q. C  / L: |% q5 o- U/ `" Q+ R- m
  while (1)
0 |& M; w" w+ S' z" m& a3 f$ k: h  {
& m+ P: q2 P  N4 U6 `; z( b, K8 z  }& v6 G* t) _- K4 t2 J4 x! X- P
}
1.png
2.png
3.jpg

9 s! p  Y# i: L! o

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
1 M( @7 g3 c+ \# @. C! q
谢楼上支持
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

' J) F) N3 M& l) R0 E: N谢楼上支持
mmuuss586 回答时间:2019-6-18 12:47:09
, Q  m) Q, B! O9 l
学习学习
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管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版