This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why is the FreeRTOS function xTimerResetFromISR not working in tickless mode?

Hi,

I modified the blinky_freertos example from SDK 12 slightly to perform the following:

I have one timer and one task. The task blinks a LED and then suspends. In the timer callback function (one second period) I resume the task to have a LED that blinks every second. I now want to synchronise my timer to the "1 pulse per second" output of GPS module. To achieve this, I create a interrupt routine that resets my timer and resumes my task (so if the timer is reset just before it would call its callback, my task is still resumed). I took care not to resume a task from the ISR with a priority higher than the task that was interrupted.

If I'm running this code with tickless mode off, everything behaves as I expect. I attached a scope screenshot that shows the blinking LED (blue) is nicely synchronized to the external interrupt (yellow). Now when I turn tickless mode on, the synchronization will fail. It looks like the end of the delay in the task is synchronized with with the interrupt, and not the start of the task. Is this a bug? If not, can anybody tell me what I'm doing wrong? Our application is battery powered so tickless mode is really a must have.

I attached my main.c, FreeRTOSConfig.h, makefile and two scope screencaps.

Thanks!

Jules

main.c updated

FreeRTOSConfig.h

tickless_off.png

tickless_on.png

blinky_freertos.rar

Parents
  • Hi Aryan,

    I have updated from SDK12 all the freertos folder and included your port_cmsis_systick.c file with the:

    extern void updateRTOSTick(void);
    

    In the portmacro_cmsis.h file. With a call to updateRTOSTick() function in the handlers (gpiote, uart, spi, etc.) that call to freertos api calls (xSemaphoreGive, xTimerResetFromISR, etc.)

    But this configuration with:

    #define    configUSE_TICKLESS_IDLE                                                   1
    

    Is not working. If I use the SDK12 original files it works but the uarte is not working properly in Rx mode. In a 8 bytes DMA dual buffer a 7 byte frame is received only the 6 first bytes ok and the seventh is captured in the seccond DMA buffer. I am missing something, is there any other thing to modify?

    If you think this subject needs to be opened in another thread move it or tell me and i create a new thread, thanks!

Reply
  • Hi Aryan,

    I have updated from SDK12 all the freertos folder and included your port_cmsis_systick.c file with the:

    extern void updateRTOSTick(void);
    

    In the portmacro_cmsis.h file. With a call to updateRTOSTick() function in the handlers (gpiote, uart, spi, etc.) that call to freertos api calls (xSemaphoreGive, xTimerResetFromISR, etc.)

    But this configuration with:

    #define    configUSE_TICKLESS_IDLE                                                   1
    

    Is not working. If I use the SDK12 original files it works but the uarte is not working properly in Rx mode. In a 8 bytes DMA dual buffer a 7 byte frame is received only the 6 first bytes ok and the seventh is captured in the seccond DMA buffer. I am missing something, is there any other thing to modify?

    If you think this subject needs to be opened in another thread move it or tell me and i create a new thread, thanks!

Children
No Data
Related