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

pugglewuggle wrote on Wednesday, February 26, 2014:

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 configUSE_TICKLESS_IDLE 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.

rtel wrote on Thursday, February 27, 2014:

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.


pugglewuggle wrote on Thursday, February 27, 2014:

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 configEXPECTED_IDLE_TIME_BEFORE_SLEEP 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 configUSE_TICKLESS_IDLE != 0 blocks and I’m still never hitting any of the breakpoints.

rtel wrote on Thursday, February 27, 2014:

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.


kamab wrote on Tuesday, March 04, 2014:

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.