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

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

[复制链接]
mmuuss586 发布时间:2019-1-25 16:30
NUCLEO-L053R8:低功耗待机模式standby/PA0唤醒(例程分享)  s- A$ R+ V  R' C5 B! k% z( }
待机模式唤醒后等同复位
基于ST官方NUCLEO-L053R8开发板
用PA0引脚唤醒(用杜邦线接高电平唤醒)
代码下载:见附件
standby mode without RTC:0.29uA VDD=3.0V
/**8 Y/ D) k6 K. a$ B0 q
* @brief  Main program$ f) T0 M* `( R/ G8 H7 W
* @param  None
* a% @/ \. s* }$ N8 y. _* @retval None
4 I& |2 o1 D6 f) F*/$ R  V( E. x0 |/ [; u9 o+ I
int main(void)
2 M: U# [$ r/ L2 Q& m) W" v: u( l{  - Z" {( `; f3 O) }" t
  /* STM32L0xx HAL library initialization:0 Q; D: K6 ?7 P. P, Z& D$ E
       - Configure the Flash prefetch, Flash preread and Buffer caches( q. z: Y0 \; ?  o6 C
       - Systick timer is configured by default as source of time base, but user
) h" G# Y; _; S- ~4 }: W             can eventually implement his proper time base source (a general purpose
: q: @( s+ \& g- o, K; w" u$ y             timer for example or other time source), keeping in mind that Time base / L2 _" Y) [/ U& J8 H' q$ |9 u0 }
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
1 n5 G: J, a+ i0 N             handled in milliseconds basis.
6 ?* E9 p$ M0 r       - Low Level Initialization
0 w- M- Y7 v" P9 K& K) X; j  ^6 q     */* P5 e' S9 O% m/ B
  HAL_Init();
0 t' B  c  o# c4 ?
2 c4 P6 M' r2 P1 J  /* Configure LED2 */
+ V8 P: v% y9 g3 u" x$ D* u  BSP_LED_Init(LED2);
- C8 L1 l! [8 @) j2 o
* B0 n7 h0 ^, z* i  /* Configure the system clock to 2 MHz */
8 P: |( v2 u  v# n+ N$ C  SystemClock_Config();! V5 u' f$ f7 b% Q
6 w# z) O7 T- [) F

9 k' u" S9 M+ @" E. P  /* Check and handle if the system was resumed from Standby mode */ ! w/ q5 h. h( `$ ]3 R
  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
( Y  p' ^) _* Z$ t3 C& S( `  {" A5 T: R1 j! H& @
    /* Clear Standby flag */
1 q$ [' S1 U- B5 w    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
: A8 K2 h+ Q7 p- a# n, S* R/ [# M4 O9 \- E: i0 U
//如果是唤醒状态,则LED亮3秒8 Y/ c2 x7 `3 \. u# \2 C% T4 i
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED" T3 J! T1 F% c+ S4 J4 l! G  P4 n
HAL_Delay(3000);- z+ u% q. O$ }4 U$ i& r$ v3 l: U
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
: s5 A- }; o$ _/ M  }: b3 p7 i0 j% J' g! N+ I
else;' Q9 f; u: q  T" N3 K
  
2 @9 C/ c, K; J* l6 H/ B/* Configure the system Power */! `5 F% v* n: x' M9 N2 j
  SystemPower_Config();' }6 w+ z4 e! k
  6 C6 V, R+ y( C4 F& s. M5 s) n
  /* Insert 1 seconds delay */3 ^* d. l: m9 D/ g7 j! L
  HAL_Delay(1000);
; k' t1 ~( F5 B' S3 R, Q2 ]* g, O. j3 |
    /*The Following Wakeup sequence is highly recommended prior to each Standby mode entry
2 E0 ^' S* T% Q     mainly  when using more than one wakeup source this is to not miss any wakeup event., Q9 s% f! V* w& ~; c$ o0 g/ b
       - Disable all used wakeup sources,  f* e# C# `6 Y0 V: `1 z" F: f
       - Clear all related wakeup flags,
) }9 k# _5 i7 r# C6 Q$ V6 q- s9 J6 [       - Re-enable all used wakeup sources,# v0 Z: [' T5 z) B
       - Enter the Standby mode.
6 g1 ^( R; ?- q" v$ n4 F: f" W6 L& Y     */8 n$ [4 G/ V# T" _. \0 O
  /*Disable all used wakeup sources: Pin1(PA.0)*/9 Q  b2 M5 u; F- R7 K; o
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
' Q5 @7 a2 C2 z" q8 I7 s  
, r; e3 [% H4 S$ @  /*Clear all related wakeup flags*/# ]& s1 E) C2 Z3 X* k  D
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
" {, B9 I+ b, H/ y  3 t" e6 s7 Y+ L6 U# V# u
  /*Re-enable all used wakeup sources: Pin1(PA.0)*/+ k% o9 D7 h' j+ d2 T
  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
$ c3 ^( u" k+ a$ L( H( d  
$ ^# s+ f, }+ J9 \( ?  /*Enter the Standby mode*/! a. _6 e. C: [5 j7 X0 [
  HAL_PWR_EnterSTANDBYMode();- q7 m/ W+ u1 K5 _
  * c/ v. g3 {( w$ k$ {; q0 i- U
  while (1). ]7 I1 p( r; m
  {( v2 i5 ?2 d+ z4 L- R
  }
* E* ]# y2 N' R6 I6 n}

+ K+ B& Y- y) |
1.png
2.png
3.jpg

$ t# f3 P+ _* q0 `1 }

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

7 C* F. N5 L0 I6 Z/ Q谢楼上支持
mmuuss586 回答时间:2019-1-27 10:09:33
8 L, X) ]  w- q" {9 t* D/ K, _$ s
谢楼上支持
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

5 I1 }( n; x& |7 g8 r6 y学习学习
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 手机版