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

NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享)

[复制链接]
mmuuss586 发布时间:2019-1-25 13:16
NUCLEO-L053R8:低功耗STOP模式,外部中断唤醒(例程分享); q( y7 l7 k! K$ O& s
基于ST官方NUCLEO-L053R8开发板
代码下载见附件
Stop mode without RTC:0.4uA VDD=3.0V
0 g  q9 Z/ e% Q* q# e; ~: I! {
int main(void)
* a; Z! ^, V* Y- ?2 n{! y& S0 z! }! X# `, p% m5 G
  /* STM32L0xx HAL library initialization:
* Z' r% i. i" k2 j! L+ C) [9 c9 J       - Configure the Flash prefetch, Flash preread and Buffer caches3 f2 T. H- I2 H7 J
       - Systick timer is configured by default as source of time base, but user
8 C- E1 R. s7 ]8 B6 p' F( A+ P2 z             can eventually implement his proper time base source (a general purpose
$ j( h& |2 k* l5 H1 w* r; [             timer for example or other time source), keeping in mind that Time base . o/ v5 `5 ?& T8 M
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and & g: p' {- \: V1 X, m9 o3 s& j, X
             handled in milliseconds basis.
: [6 I/ d, x" n" V% o8 u  i( z- g       - Low Level Initialization- s3 \$ ]0 r6 q: f5 X$ j. Q
     */$ t6 w0 S0 U4 n& `* k  C& \3 L- r
  HAL_Init();. n7 Y  E/ c9 j3 H" k3 A6 s) Q5 J

0 i0 W; q# y8 a( o* I  /* Configure LED2 */! b0 d% ]  Z& y  S2 C) u& ]! }
  BSP_LED_Init(LED2);
+ h2 i3 B5 a/ Z, ?' b1 ?: S; ]. E- _2 @% h$ G# L
  /* Configure the system clock @ 32 Mhz */9 W! ?' M' ]  t7 ]
  SystemClock_Config();/ J( E9 f; A/ v. q
  * r; U8 I" u- L7 m1 Z/ D+ R0 J0 e
  /* Configure the system Power */: d1 k9 O/ z$ T, _1 J0 Z
  SystemPower_Config();
- Y; A6 C* x) ]& e# v$ K' l
2 n0 h1 _- V! ^' O  while (1)2 Q( `- ?6 N2 {
  {" f, E- I, p4 w) E* k( V. `0 {( J8 Q
    /* Insert 5 second delay */  T4 a' J, }0 a* N# _9 g
BSP_LED_Init(LED2);        //LED初始化 8 I$ P/ K+ y9 d
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);        //点亮LED,延时3S,再灭LED
" T9 R( I: s" f! w& z+ J    HAL_Delay(3000);# v* B7 {9 w/ D7 ?9 T% U8 i7 J2 n
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
3 Y4 o* G& G$ v+ m4 P    HAL_Delay(3000);
( A$ _" Z+ \5 k' _1 iSystemPower_Config();        //关闭所有IO和时钟
* n( w1 E, R! C% {3 G    /* Key button (EXTI_Line13) will be used to wakeup the system from STOP mode */+ [" q* @$ s; M, V% d3 |
    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);
+ `) |) f, |4 T, @+ [
. t' _; E( f1 s( K. c5 {9 x    /* Enter Stop Mode */% m3 V, o; B/ f! G& y+ `
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
3 X& l1 W. o% f) ~- p6 T# Q) h% t3 y0 j' z- E5 ]8 j5 M
    /* Configures system clock after wake-up from STOP: enable HSE, PLL and select
! y8 Z) d& q+ l% R7 W    PLL as system clock source (HSE and PLL are disabled in STOP mode) */7 ?/ s4 M" C" r
    SystemClockConfig_STOP();' ]# u  C; ~$ D1 g0 J4 m( B  y
  }5 o; A. R/ B5 J) y9 p) g6 l
}
) X% ?" n" H8 D( h5 p( Y: C
1.png
2.png
3.jpg
* p4 O/ q* n! H9 T3 `1 r7 s
& U% F% C& [9 Z0 p, Y

PWR_STOP.rar

下载

4.01 MB, 下载次数: 45

收藏 评论18 发布时间:2019-1-25 13:16

举报

18个回答
mmuuss586 回答时间:2019-5-7 09:47:39
( z9 y2 A" U! t. _" `; ~
感谢支持
generalcircuits 回答时间:2019-7-26 11:15:23
谢谢分享!参考学习
mmuuss586 回答时间:2019-7-27 11:32:59
谢楼上支持
mmuuss586 回答时间:2019-1-25 13:16:59
:)
Paderboy 回答时间:2019-1-25 13:50:32
多谢分享
mmuuss586 回答时间:2019-1-25 14:41:34

" i0 _* f' _4 Z& o谢版主支持
Kevin_G 回答时间:2019-1-26 16:26:12
参考下
mmuuss586 回答时间:2019-1-27 10:09:56

% q; C# D1 S* m% v8 t谢楼上支持
mmuuss586 回答时间:2019-2-3 20:11:56
拙夫 回答时间:2019-5-7 09:15:31
mmuuss586 回答时间:2019-6-18 12:45:36

* ^. U7 s3 Q: _1 Q3 B学习学习
mmuuss586 回答时间:2019-7-26 09:22:24
:D:D:D
mmuuss586 回答时间:2019-8-16 09:18:57
:D:D
mmuuss586 回答时间:2019-10-4 13:30:57
12下一页

所属标签

相似分享

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版