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

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

[复制链接]
mmuuss586 发布时间:2019-1-25 16:30
NUCLEO-L053R8:低功耗待机模式standby/PA0唤醒(例程分享)
  V/ C0 T2 w0 t
待机模式唤醒后等同复位
基于ST官方NUCLEO-L053R8开发板
用PA0引脚唤醒(用杜邦线接高电平唤醒)
代码下载:见附件
standby mode without RTC:0.29uA VDD=3.0V
/**
) m. p* V0 {! W" _% M' O. F$ r* @brief  Main program
' o9 {2 N: C, j6 H* @param  None
+ ?) D* I; b4 {& w2 z* @retval None
( G4 T* w" z4 a# W$ ^: r. f*/
' E0 ^* w& @/ L. h- ?3 Oint main(void)% A  Y; f! C7 k. n: [/ G$ o
{  " }3 f0 V" r# Y* ~% X( y9 ^- q
  /* STM32L0xx HAL library initialization:# M) @5 ^- {+ o$ e) @* `
       - Configure the Flash prefetch, Flash preread and Buffer caches
  n# m6 O+ q; p       - Systick timer is configured by default as source of time base, but user 8 z# b+ ^/ Y$ ~% Z+ J9 d( l- d* V4 k
             can eventually implement his proper time base source (a general purpose . ?! X' I+ Q$ y3 [+ @2 T8 a" {
             timer for example or other time source), keeping in mind that Time base
) x+ N& i% K9 r$ l; i3 M( l' L             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and ' D6 s' S& Z0 x+ d" i# B
             handled in milliseconds basis.
  }" W4 c4 i7 |       - Low Level Initialization% u: p* y; q, \& o
     */
6 }0 q$ s+ Z7 Q  HAL_Init();
; U2 z, Z' W0 _; S2 G2 s5 j9 w7 a' |5 x4 V
  /* Configure LED2 */, E9 H/ P$ S( y
  BSP_LED_Init(LED2);
7 l" {  q# B+ [+ u( R/ a' N9 ~5 s( z. Y" b1 S8 z
  /* Configure the system clock to 2 MHz */
" D/ t5 k* v, R4 W1 u; @9 O  SystemClock_Config();; p: S% [( K, U

- }( _9 n; h' A( T. e( C) v
1 N2 L* f6 j: J$ U" L$ s  /* Check and handle if the system was resumed from Standby mode */ - V' o9 O5 C0 I$ o9 T; R0 ~
  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
- J1 u  N8 y$ c; \- V1 O+ B3 v  {& \, M: v/ c! ^4 l( c
    /* Clear Standby flag */
. H' o& i/ h/ L& _- n) d    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
1 W6 T* n7 b! X, v' o- S5 }4 {6 x
//如果是唤醒状态,则LED亮3秒
: G) Q. n8 B% }" JHAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED+ @& O' x% W# v/ [
HAL_Delay(3000);
, N0 R) G2 b- d. K/ N! JHAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);2 x5 e( q4 ]$ w  j$ ~
  }
. c2 i4 ?: n3 S  k6 F/ Q& X; Yelse;
2 b3 L6 t3 N1 h" v9 e7 D, m% O" {  - \% B5 @1 a+ m/ Q$ M1 h
/* Configure the system Power */
: z# }0 J. V4 Q" s! `- K1 T  SystemPower_Config();: V3 A# }) }& V& }9 ^/ A6 m$ x
  7 r/ F1 K+ X* P0 l& j) U+ A
  /* Insert 1 seconds delay */
. C; k" ^9 `* M) ]! K- O  HAL_Delay(1000);. H* t) g, x3 [9 \
. j: ~. Q1 I: c/ V+ a9 ]
    /*The Following Wakeup sequence is highly recommended prior to each Standby mode entry# p/ a1 J* a2 Z! ~
     mainly  when using more than one wakeup source this is to not miss any wakeup event.
. v6 l1 S" h+ K& O: x6 v       - Disable all used wakeup sources,
' r6 ^% q+ j/ c6 ~1 |       - Clear all related wakeup flags, # E0 r6 ?# [: c
       - Re-enable all used wakeup sources,
5 D/ W. d! k+ F5 t% o! j6 e. H       - Enter the Standby mode.2 u# s) [# y' @5 M0 X5 u
     */
! {+ j/ q9 Y! _, z1 a  /*Disable all used wakeup sources: Pin1(PA.0)*/  o+ ~9 N$ _9 l+ X
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
& }; k: q$ e3 ]) v0 G9 N  7 q* d7 {3 n5 q4 h
  /*Clear all related wakeup flags*/
7 n# E4 y  f( N8 d$ W  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);* ?% U0 }5 F0 d, I7 B( p1 ^
  
' L. a7 Q6 A2 I  x& L# N  /*Re-enable all used wakeup sources: Pin1(PA.0)*/
3 B, ?" A9 P% j  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);2 w3 c$ v+ E5 w
  - E6 y) K: Q1 Y" N: d
  /*Enter the Standby mode*/( B; I' E, }9 \  b. y1 r
  HAL_PWR_EnterSTANDBYMode();
  \! ~6 e/ V  L# v! k1 q" E  $ w7 I, c$ \7 I
  while (1)- t/ o8 r$ {/ N) p4 H, A% e8 m
  {, Z! _; t4 T! N% }
  }
7 V7 O, b8 ^: V4 r& B}

  y4 E& H* |4 z" j6 l! K6 p
1.png
2.png
3.jpg
$ P; A8 R7 A2 ^4 d3 s7 O; y; c# g

PWR_STANDBY.rar

下载

4.04 MB, 下载次数: 28

赞 收藏 1 评论16 发布时间:2019-1-25 16:30

举报

16个回答
generalcircuits 回答时间:2019-9-5 15:16:28
感谢分享,学习一下
mmuuss586 回答时间:2019-9-2 09:05:35
" G) P! u' `# R: J
谢楼上支持
mmuuss586 回答时间:2019-1-27 10:09:33
6 R( y. ^4 A6 p* \. Z* b$ E" R6 C
谢楼上支持
mmuuss586 回答时间:2019-1-25 16:31:04
Kevin_G 回答时间:2019-1-26 16:23:27
参考参考
mmuuss586 回答时间:2019-2-3 20:13:56
:):):)
mmuuss586 回答时间:2019-6-18 12:46:51
0 S  S( Z7 Q/ R# T
学习学习
mmuuss586 回答时间:2019-7-26 09:23:11
:D:D:D
mmuuss586 回答时间:2019-8-16 09:24:21
:D
datouren 回答时间:2019-9-2 08:43:01
参考下。。。。。。。
mmuuss586 回答时间:2019-9-10 12:36:28
感谢支持
mmuuss586 回答时间:2019-10-4 13:32:05
mmuuss586 回答时间:2019-10-4 13:32:27
:D
mmuuss586 回答时间:2019-10-7 21:31:33
:(
12下一页
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版