在手臂皮质 m4 上进入睡眠模式 [英] Entering sleep mode on arm cortex m4

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

问题描述

我正在尝试让 cortex 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.

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

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