Hello,
I'm trying to implement a sleep mode for my application. Currently it has around 8 tasks.
I need to disable them all + disable some HW, such as GPS module. And wait for ISRs to wake it up from either: GSM module or accelerometer.
There are 2 problems currently:
1. First as it was mentioned in many tickets before f.e. here, that sleep mode actually does not sleep when all tasks are disabled.
Device wakes up constantly for unknown event/ISR and goes back to sleep.
It seems that SD is actually doing some job and constantly wakes up here:
if (nrf_sdh_is_enabled())
{
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}
In addition, WDG is enabled and even though it configured to freeze in sleep mode, soon it will reset the system.
Additional info:
- configUSE_TICKLESS_IDLE is enabled
- also SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; instruction is used to indicate DeepSleep
Is there something else that needs to be done to have a correct behaviour in deep sleep mode ?
Here is trace record from SystemView:
After all tasks were suspended ISR triggers constantly after 1-2 ms.
2. Since all tasks use xTaskDelayUntil(), when there is a wakeup ISR that returns system back to normal. Call to xTaskResume(), makes all those
tasks to execute immediately for all that time that was skipped, which of course breaks the system. Thus the question is what is the correct way to put FreeRTOS system in deep sleep?