简体   繁体   English

嵌入式RTOS停止系统

[英]Embedded RTOS Stop System

I'm learning FreeRTOS on a Cortex M0. 我正在学习Cortex M0上的FreeRTOS。 (Simultaneously, I'm learning the Cortex as well...). (同时,我也在学习Cortex ......)。 I've got plenty of experience with 8bit MCUs. 我有8位MCU的丰富经验。

I'm going through the newbie tutorials on FreeRTOS and I understand setting up basics tasks and the idle daemon. 我正在浏览FreeRTOS上的新手教程,我理解设置基本任务和空闲守护进程。

I realize I don't really understand what the FreeRTOS is doing to manage the underlying timing mechanicals of the kernel. 我意识到我并不真正了解FreeRTOS正在做些什么来管理内核的基础时序机制。 Which leads to one big question... 这导致一个大问题......

What is the ideal way to shutdown an RTOS when you want to turn your device off? 想要关闭设备时关闭RTOS的理想方法是什么? Not idle the device, but put your MCU into the deepest OFF there is (whatever you want to call it). 没有闲置设备,但将你的MCU置于最深处OFF(无论你想要什么叫它)。

It seems trivial, to idle between tasks, but shutting the MCU off and making sure it stays off, and the RTOS kernel doesn't trigger an interrupt or somethign else to wake the MCU back up...? 在任务之间闲置,但关闭MCU并确保它保持关闭似乎是微不足道的,并且RTOS内核不会触发中断或其他任何其他方式唤醒MCU备份......?

this is deep sleep mode / power down mode , for an 8-bit MCU this is in the datasheet of ATmega128RFA1 on page 159 ff in http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8266-MCU_Wireless-ATmega128RFA1_Datasheet.pdf ( with the wake-up sources ) in this mode all internal timers are disabled 这是深度睡眠模式/掉电模式 ,对于8位MCU,这可以在第159页的ATmega128RFA1数据表中找到网址为http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8266-MCU_Wireless- ATmega128RFA1_Datasheet.pdf (带有唤醒源)在此模式下,所有内部定时器都被禁用

in freeRTOS this is named Tickless Idle Mode , cf https://www.freertos.org/low-power-tickless-rtos.html 在freeRTOS中,这被命名为Tickless Idle Mode ,参见https://www.freertos.org/low-power-tickless-rtos.html

Note: If eTaskConfirmSleepModeStatus() returns eNoTasksWaitingTimeout when it is called from within portSUPPRESS_TICKS_AND_SLEEP() then the microcontroller can remain in a deep sleep state indefinitely. 注意:如果eTaskConfirmSleepModeStatus()在从portSUPPRESS_TICKS_AND_SLEEP()内部调用时返回eNoTasksWaitingTimeout,则微控制器可以无限期地保持深度睡眠状态。 eTaskConfirmSleepModeStatus() will only return eNoTasksWaitingTimeout when the following conditions are true: 当满足以下条件时,eTaskConfirmSleepModeStatus()将仅返回eNoTasksWaitingTimeout:

  1. Software timers are not being used, so the scheduler is not due to execute a timer callback function at any time in the future. 软件定时器未被使用,因此调度程序不会在将来的任何时间执行定时器回调函数。

  2. All the application tasks are either in the Suspended state, or in the Blocked state with an infinite timeout (a timeout value of portMAX_DELAY), so the scheduler is not due to transition a task out of the Blocked state at any fixed time in the future. 所有应用程序任务都处于Suspended状态,或者处于Blocked状态且具有无限超时(超时值为portMAX_DELAY),因此调度程序不会在将来的任何固定时间将任务转移到Blocked状态。

To avoid race conditions the RTOS scheduler is suspended before portSUPPRESS_TICKS_AND_SLEEP() is called, and resumed when portSUPPRESS_TICKS_AND_SLEEP() completes. 为了避免竞争条件,RTOS调度程序在调用portSUPPRESS_TICKS_AND_SLEEP()之前被挂起,并在portSUPPRESS_TICKS_AND_SLEEP()完成时恢复。 This ensures application tasks cannot execute between the microcontroller exiting its low power state and portSUPPRESS_TICKS_AND_SLEEP() completing its execution. 这确保了应用程序任务无法在退出其低功耗状态的微控制器和完成其执行的portSUPPRESS_TICKS_AND_SLEEP()之间执行。 Further, it is necessary for the portSUPPRESS_TICKS_AND_SLEEP() function to create a small critical section between the tick source being stopped and the microcontroller entering the sleep state. 此外,portSUPPRESS_TICKS_AND_SLEEP()函数必须在停止的滴答源和微控制器进入睡眠状态之间创建一个小的临界区。 eTaskConfirmSleepModeStatus() should be called from this critical section. 应该从这个关键部分调用eTaskConfirmSleepModeStatus()。

All GCC, IAR and Keil ARM Cortex-M3 and ARM Cortex-M4 ports now provide a default portSUPPRESS_TICKS_AND_SLEEP() implementation. 所有GCC,IAR和Keil ARM Cortex-M3和ARM Cortex-M4端口现在都提供默认的portSUPPRESS_TICKS_AND_SLEEP()实现。 Important information on using the ARM Cortex-M implementation is provided on the Low Power Features For ARM Cortex-M MCUs page. 有关使用ARM Cortex-M实现的重要信息,请参见ARM Cortex-M MCU的低功耗特性页面。

so in freeRTOS invoking tickless idle mode is equivalent to deep sleep or power down. 所以在freeRTOS中调用无空闲空闲模式相当于深度睡眠或掉电。 possibly you have to manually disable internal timers on the cortex ... 可能你必须手动禁用皮质上的内部计时器...

had some problems powering down the ATmega128RFA1 MCU in Contiki OS ... 在Contiki OS中关闭ATmega128RFA1 MCU时出现了一些问题......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM