This is a basic question, but I am using FreeRTOS from Microchip Harmony. I wanted to put the microcontroller into sleep mode, so I entered the sample code from 11 Low Power Support in the manual, but I got a compilation error. Even if I declare #include “FreeRTOS.h” and #include “task.h”, an error occurs if there is no function. Should I find a function to replace prvsleep() and implement it?
as far as i know, there is no such function in freertos, you have to implement it by yourself
Where did you get this code? Where is this function used?
Mr.aggarg
Thank you for your reply.
This code is at the bottom of page 277 of Mastering-the-FreeRTOS-Real-Time-Kernel.v1.1.0.pdf.
Is this manual an example for other development environments?
Thank you for your reply.
I’m currently looking for something that can be used from a development environment.
The connection between the microcontroller manufacturer and FreeRTOS
is not always fully explained.
Thank you for sharing these details. This code is an example to show how an application can implement portSUPPRESS_TICKS_AND_SLEEP
. The function prvSleep
is supposed to put the MCU to sleep/low power mode. The function does not need to be necessarily called prvSleep
. For example, the cortex-M4 port implements it using a couple of assembly instructions: FreeRTOS-Kernel/portable/GCC/ARM_CM4F/port.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub.
Did you check whether the port for you hardware provides a default implementation of portSUPPRESS_TICKS_AND_SLEEP
or not?
Hello aggarg,
I misread it. I was trying to implement the extended code even though portSUPPRESS_TICKS_AND_SLEEP() was already there.
I’m testing it without using Free-RTOS, so I’ll check if it wakes up from sleep by triggering a timer interrupt.
Thank you.