在Arm Cortex M4上进入睡眠模式 [英] Entering sleep mode on arm cortex m4

查看:408
本文介绍了在Arm Cortex M4上进入睡眠模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使皮质m4处理器睡眠不到一秒钟.我希望能够告诉它进入睡眠状态,然后再等待一秒钟,或者当按下一个按钮时,从我上次中断的地方开始接起电话.我查看了参考手册,并且VLPS模式看起来很适合我的需求.我不知道如何开始进入该模式或如何对NVIC进行编程.

I'm trying to put a cortex m4 processor to sleep for a little less than a second. I want to be able to tell it to sleep, then a second later, or when a button is pressed, pick up right where I left off. I've looked in the reference manual and VLPS mode looks like it would fit my needs. I don't know how to begin to enter that mode or how to program the NVIC.

更多信息: 我正在用C在裸机上执行此操作.

More Info: I am doing this in C, on the bare metal.

推荐答案

您可以下载并检查实现此演示.尽管该演示是针对RTOS的,但无论是使用RTOS还是应用程序在裸机上运行,​​用于使CPU进入睡眠模式的代码都是相同的.

You can download and inspect the code that implements this demo. Although the demo is for an RTOS the code used to place the CPU into a sleep mode is the same whether an RTOS is being used or the application is running on bare metal.

您可以执行一些常规操作来将Cortex-M3内核置于低功耗状态(请参见WFI指令).为了获得极低的功耗,那么您还必须做一些特定于芯片的事情.上面的链接代码在调用WFI之前执行了一些特定于芯片的预睡眠处理(外围设备的翻转,设置了芯片自己的睡眠模式等),然后在从WFI指令返回时执行了某些特定于芯片的事情.

There are generic things you can do to place a Cortex-M3 core into a low power state (see the WFI instruction). To get extreme low power then you have to do chip specific things as well. The above linked code performs some chip specific pre-sleep processing (turn of peripherals, set the chips own sleep mode, etc.) before calling WFI, then does some chip specific things when it returns from the WFI instruction.

为什么在这里而不是在专门讨论ARM处理器的论坛上问这个问题?

Why are you asking this question here rather than on a forum dedicated to ARM processors?

这篇关于在Arm Cortex M4上进入睡眠模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆