CortexM4 doesn’t appear to be sleeping when using configUSE_TICKLESS_IDLE 1

I could be wrong about this or just don’t know how to verify the device is sleeping, but it doesn’t appear to be sleeping even though configUSETICKLESSIDLE is defined as 1. I’ve checked FreeRTOS viewer and all tasks are blocked, only IDLE is running. Is there a way for me to verify the chip is sleeping? I don’t currently have a place to plug in an ammeter on the development board and the default sleep mode (Sleep) of the Atmel SAM4S I’m using doesn’t turn off the master clock.

CortexM4 doesn’t appear to be sleeping when using configUSE_TICKLESS_IDLE 1

Look for the suppress ticks and sleep function in whichever port.c file you are using and put a break point in it. Is the break point ever hit? If not look for where the function is called from task.c, put a break point there to see why the function is not called – maybe the calculated sleep time never reaches the threshold necessary. Regards.

CortexM4 doesn’t appear to be sleeping when using configUSE_TICKLESS_IDLE 1

I already did that before I posted so I am certain it is never being hit but since I’m not 100% familiar with all the internal workings of the kernel I thought maybe there was something else going on inside of it. We have the configEXPECTEDIDLETIMEBEFORESLEEP set at its default value of 2 (we haven’t define it). On top of that I put breakpoints in tasks.c at every point where a function is called or code executed inside #if configUSETICKLESSIDLE != 0 blocks and I’m still never hitting any of the breakpoints.

CortexM4 doesn’t appear to be sleeping when using configUSE_TICKLESS_IDLE 1

It’s difficult to say without being able to see a debug session. If the breakponts are being set then the code must be being compiled in so it a matter of viewing the variable values as you step through to ascertain why the code is not entered. Regards.

CortexM4 doesn’t appear to be sleeping when using configUSE_TICKLESS_IDLE 1

Are you sure your application is ever being given the chance to sleep? Usually you would need > 2 ticks to pass without any task being scheduled to allow for tickless mode to be entered. You should hit those breakpoints. Look for an error in your config file.