freertos lock timer problem

Greetings ,
I have implemented an application with freertos (sdk 15.3)
which goes into low power and wakes up on two irqs (rtc and button).
When the button irq arrive turns on the system,  performs operations
and then return to a low power state.
When entering low power the task/int rtc are suspended , restored
on wake up.
The anomaly occurs when the system remains in the low
power state   , when I wake up i find that the task
remains frozen / paused (in vTaskDelay / xEventGroupWaitBits ) for a time
proportional to the time it remained in low consumption .
Anyone have any ideas on what to investigate (or a hint) to solve the problem ?

Best regards
Andy

Parents Reply Children
  • Hi ,

    in the zip files with some notes.

    https://sendgb.com/FBVOHl1io9j

    Thanks in advance ,
    Best regards
    Andy

  • Hi ,

    i have found something , if i set a define to 1 ( configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 1 )    the problem does not arise.

    Have any idea what it might mean ? 

    Best regards
    Andy

  • configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG  was designed for tickless sleep and is helpful to have the application have normal debugging experience in the debug mode. In tickless sleep the RTC IRQ is disabled but service the RTC irq is crucial for keeping the internal rtos timer tick updated. So after wakeup from sleep from tickless , the rtc tick handler checks if any ticks handling was missed and updates the internal rtos ticks as needed. In debug mode you do not want to have this feature because you can halt the cpu and you do not want to internal rtos ticks to be updated while the cpu is halted in the debug mode. This will cause all the timers to expire due to internal tick corrections. Hence this config gives you the ability to disable autocorrection and should only be useful when you are debugging the code using a debugger, stepping or halting the CPU.

    when I wake up i find that the task
    remains frozen / paused (in vTaskDelay / xEventGroupWaitBits ) for a time
    proportional to the time it remained in low consumption .

    Something is not right here. Where is this vTaskDelay come into picture from? was there a delay executed in the task just before the sleep or was this vTaskDelay called after wakeup? What is the wakeup Disabling this feature fixes the issue does not sound architecturally correct. 

    How are you observing this problem? are you in the debug mode while this problem happens?

  • Hi ,
    here are some answers .

    Something is not right here. Where is this vTaskDelay come into picture from?
    was there a delay executed in the task just before the sleep or was this vTaskDelay called after wakeup?
    What is the wakeup Disabling this feature fixes the issue does not sound architecturally correct.

        Yes,the lock is present after the restart from low power

    How are you observing this problem? are you in the debug mode while this problem happens?
        
        I inserted some gpio (+ vTaskDelay) to see the passage in the function.
        There is one task to manage low consumption in and out, and one to manage the event .
        The two tasks stop immediately ,after the exit from low consumption, in the delay functions.
        This test was done in release .

    In a subsequent test in debug mode I tried to find the function that could
    slow down the system and i went back to the xPortSysTickHandler and the
    configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG .
        
    Best regards
    Andy

Related