I’m currently working on a project where I have a dual-threaded system using FreeRTOS, and my primary goal is to minimize power consumption. I have two threads in my system, each with its own sleep requirements. Here’s what I’m trying to achieve:
Thread 1: This thread needs to go into sleep mode every 1 minute after receiving valid data. The idea here is to conserve power when the thread is not actively processing any new data.
Thread 2: This thread needs to go into sleep mode for every 5 minutes after sending data. The aim is to reduce power consumption during periods of inactivity, as the thread doesn’t have any immediate tasks to handle after data transmission.
To accomplish these goals, I’m looking for guidance on how to effectively utilize FreeRTOS’s sleep mode functionality. How can I implement this in my system to achieve the desired power savings?
Note, “Threads” going to sleep don’t save power, as the processor just goes to another task. This is also not normally called “sleeping”, but the thread BLOCKING.
You save power by having the PROCESSOR go to sleep.
It sounds like you want Thread 1 to block for up to a minute waiting to get data, and after that mark that it thinks it is ok to put the processor into a deeper sleep, and Thead 2 to similarly block for up to 5 minutes waiting for data to send (or maybe you can know if you aren’t going to get more data to send). If both agree, then perhaps you can enter a deeper sleep than just tickless idle.
Using light/deep sleep with an RTC timer wakeup could be useful for this application. The wifi stack will have to be stopped if using either of the sleep modes. Any active connections will be lost, however.