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

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

[复制链接]
mmuuss586 发布时间:2019-1-25 16:30
NUCLEO-L053R8:低功耗待机模式standby/PA0唤醒(例程分享)4 s$ l5 ^$ F  Y
待机模式唤醒后等同复位
基于ST官方NUCLEO-L053R8开发板
用PA0引脚唤醒(用杜邦线接高电平唤醒)
代码下载:见附件
standby mode without RTC:0.29uA VDD=3.0V
/**
5 B( K" F$ w$ p4 K! Q' U+ o- e1 G* @brief  Main program0 ^* t4 g. c% a7 q
* @param  None, _5 N, `  q( H+ Z& ~
* @retval None" [7 g9 R0 i7 r
*/
* G- d  N. F9 R- U: Y$ ^9 T7 T2 y: H% hint main(void)
# R4 H1 u! x' g# m{  
0 q& _+ R  p# P- n" u. ]4 I( ?% C6 w* l  /* STM32L0xx HAL library initialization:  j; R- S3 H0 m' E, d
       - Configure the Flash prefetch, Flash preread and Buffer caches
$ E9 {4 _3 k) s! }: |: e       - Systick timer is configured by default as source of time base, but user
' e  |: h6 A7 ?1 h* x7 t             can eventually implement his proper time base source (a general purpose * @# z& V: Z0 A/ B
             timer for example or other time source), keeping in mind that Time base
5 l- \( n% E# S: ?; z5 Z             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
4 [9 l7 l" J3 {- a. T# I             handled in milliseconds basis.4 V/ h+ @' P* M9 w. Z: s+ G
       - Low Level Initialization5 _: E: U$ {. a9 H2 e
     */
; k8 x+ s* f" T6 v* @1 r  HAL_Init();" J' e# [; p) w3 q' V) X8 X

  `" s, y* {8 o: [9 r3 f  /* Configure LED2 */# E$ a- H- C" D
  BSP_LED_Init(LED2);6 u9 p8 Y5 [+ e* p
* t% M. F) E. C7 a
  /* Configure the system clock to 2 MHz */8 t( X! f$ V3 [. {- L( ~0 v
  SystemClock_Config();
& k, G6 }& P/ h
4 y9 |! u2 A/ l$ [3 f* C8 g8 O4 |( T* ~; u
  /* Check and handle if the system was resumed from Standby mode */ ) s3 e7 d: @; u/ M2 c
  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)8 r) C- G* ^) ]7 L( A% N! R8 Z
  {
) M9 ], r# y  O% T* {% f    /* Clear Standby flag */: G* |$ W& h, H! i
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);5 |% l8 v) z' `- d. M2 K

5 D* o  I% F1 c) Z//如果是唤醒状态,则LED亮3秒6 W: P; x% J$ E" {- }0 c( K
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED6 Z: S7 \$ m3 L& Q* U3 E  ]! V. O2 H2 u1 a3 M
HAL_Delay(3000);' T0 ^/ v, S4 ]. L& `
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);( R% Y6 S" l) ]& M& u; q, r
  }$ `2 G" i: Q" z* }% ~6 E, R
else;
: C7 u6 e/ d$ O" I  " q1 w; u9 K+ z: I$ x+ m% ]( W6 L
/* Configure the system Power */
4 S6 \# j: g# j3 Z6 L7 V  SystemPower_Config();
6 ^! h6 R8 e$ u  
3 n# d; R! W: [( R# e, p5 O+ T  /* Insert 1 seconds delay */8 ^: l; ?$ R! b
  HAL_Delay(1000);
: S. Q& g0 t, z& V$ [9 n! [3 I  b  \/ x  e7 Q2 F3 P
    /*The Following Wakeup sequence is highly recommended prior to each Standby mode entry+ P7 u+ M0 }% V* k
     mainly  when using more than one wakeup source this is to not miss any wakeup event.
4 H; @- e; ^, Q9 V       - Disable all used wakeup sources,5 x8 F& l7 v/ A# {5 @$ T; n1 H/ U' e
       - Clear all related wakeup flags,
2 n; s5 T1 b3 d3 Z3 W       - Re-enable all used wakeup sources,
6 w# u1 }+ ^/ e* T- m2 t% g( D       - Enter the Standby mode.
1 r+ X+ y3 h8 |: u( N     */" N3 ?. A# n; P% l$ T9 G) J
  /*Disable all used wakeup sources: Pin1(PA.0)*/* {# s4 V0 h6 ?
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);% P$ I. K) J! B- }
  
' Y  T# V) }' e& n; L! C# `/ A- h  /*Clear all related wakeup flags*/
( y5 V% V7 A9 m% h, k/ M: G2 B  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);7 z: }$ k1 `( o6 Q' ?7 x
  
1 x4 ^8 u- z+ m# E  Y% H) {  /*Re-enable all used wakeup sources: Pin1(PA.0)*/& U; i# e+ o" Q8 Y
  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);. M. P" i$ G, [
  
$ f( c+ H* N3 U) \* t$ i% n: |# |  /*Enter the Standby mode*/9 o5 O/ b( U' Q; d/ A4 b
  HAL_PWR_EnterSTANDBYMode();2 j- S5 O* k- p3 }1 [3 V
  
5 J, V+ T( v0 B" j, i  while (1). O$ O: Z- e9 @6 @! m3 I  X
  {) ^8 i; D- H4 t$ ~# E& U% C9 i* B
  }
9 h9 j( M; B; ]2 c}

2 K7 R0 m. ]- \' t) S8 r
1.png
2.png
3.jpg

9 u( N" X& E& q) o6 q

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
2 q5 o( L" c2 v; O' [  u& ?
谢楼上支持
mmuuss586 回答时间:2019-1-27 10:09:33
3 l4 Z, A" A6 d" ]
谢楼上支持
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

2 v! Q" i0 Y6 Y/ g3 b0 p0 l. x  Z) b8 H学习学习
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管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版