天线|RF射频
直播中

李妍

7年用户 216经验值
私信 关注
[问答]

nrf51822低功耗睡眠模式的软件应用?

nrf51822芯片datasheet原文,说是系统可以设置在System OFF MODE,此模式下CPU停止,外设运行,RAM数据保存,是最省电的睡眠,系统可以被GPIO的detect信号唤醒而后重启,原文如下:



System OFF is the deepest power saving mode the system can enter. In this mode, the system’s core

functionality is powered down and all ongoing tasks are terminated. The only mechanism that is functional

and responsive in this mode is the reset mechanism.

One or more blocks of the RAM can be retained in System OFF mode depending on the settings in the

RAMON register.

The system can be woken up from system OFF mode either from the DETECT signal generated by the GPIO

peripheral, or from a reset. When the system wakes up from OFF mode, a system reset is performed.



库函sd_power_system_off()的函数说明是:Puts the chip in System OFF mode. 我用这个函数点灯基本确定CPU是睡下去了,但是GPIO中断没有唤醒起来。



芯片GPIO关于DETECT信号有这样的说明,如下:




ORT is an event that can be generated from multiple input pins using the GPIO DETECT signal. The event

will be generated on the rising edge of the DETECT signal. See section 13.1 on page 55 for more information

about the DETECT signal.

This feature is always enabled although the peripheral itself appears to be IDLE, that is, no clocks or other

power intensive infrastructure have to be requested to keep this feature enabled. This feature can therefore

be used to wake-up the CPU from a WFI or WFE type sleep in System ON with all peripherals and the CPU

idle, that is, lowest power consumption in System ON mode.



我个人觉得,detect信号就是一个高低电平,GPIO原文也说这个DETECT信号可以将CPU从睡眠模式唤醒,但是实际却还是没有唤醒。希望有搞这一块的朋友帮一起看看,或者加QQ312382027讨论一下。谢谢哈

回帖(7)

陈龙

2020-7-20 11:54:13


        不太正確喔!system off mode 除了core停止,peripheral也是停止的,功能幾乎等同關機,RAM可以設定是否保存(需耗費額外電力),喚醒除了power on reset,其他方式要在NRF_POWER register進行設定喚醒源(RESETREAS)



而 sd_app_evt_wait功能等同m0裡的WFE__,core停止,peripheral可以單獨運行,差別在enable softdevice時使用 sd_app_evt_wait,disable softdevice時使用WFE__



       



        補充一下你看得GPIO DETECT 內容是使用GPIOTE的port event觸發 WFI or WFE用的!跟喚醒system off 不同

举报

孙成红

2020-7-20 12:02:26
此外,蓝牙好几个Demo应用软件中有个power_manage()的应用,小弟看了这是调用库函数

       
               
                       
                       
                       
                       
                       
                       
               
       

                                sd_app_evt_wait
                       

                                (
                       

                               

                       

                       

                                )
                       

                       

,关于这个函数nordic官网SDK提供的API手册说明如下:


       
               
                       
                               
                               
                               
                               
                               
                               
                       
               
       

                                        uint32_t sd_app_evt_wait
                               

                                        (
                               

                                        void 
                               

                               

                                        )
                               

                               



       


                Waits for an application event.
       


       


                An application event is either an application interrupt or a pended
interrupt when the interrupt is disabled. When the interrupt is enabled
it will be taken immediately since this function will wait in thread
mode, then the execution will return in the application's main thread.
When an interrupt is disabled and gets pended it will return to the
application's thread main. The application must ensure that the pended
flag is cleared using sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
disabled interrupts, as the interrupt handler will clear the pending
flag automatically for enabled interrupts.
       


       


                In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR).
       


See AlsoCMSIS_SCBNoteIf an application interrupt
has happened since the last time sd_app_evt_wait was called this
function will return immediately and not go to sleep. This is to avoid
race conditions that can occur when a flag is updated in the interrupt
handler and processed in the main loop.PostconditionAn application interrupt has happened or a interrupt pending flag is set.Return values
       
               
                       
                               
                               
                       
               
       

                                        NRF_SUCCESS
                               

                               



小弟英文水平有限,看了几遍也没看明白这个函数到底有什么作用?如何用? 哪位大哥大姐大神,百忙中能抽点空,帮看看讨论讨论,拜谢哪。

举报

赵秀英

2020-7-20 12:28:38

这位大神说的非常正确,请问还在弄这款MCU芯片吗,以后希望多多指教呀!!
举报

李淑珍

2020-7-20 12:45:58

哪裡!聞道有先後,目前持續研究中,下周要去聽nrf52的發表啦,大家切磋切磋囉
举报

更多回帖

发帖
×
20
完善资料,
赚取积分