Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


Using Software Timers & Tickless Idle Mode

Posted by bryce78 on March 10, 2017

Hello Community!

I am wondering about the compatibility of software timers and low-power tickless idle modes to sleep indefinitely. I read in the version history that around v8.2.3 there were enhancements/fixes made **"to the software timer code that allows tickless low power applications to sleep indefinitely when software timers are used". **

However, this does not appear to be working for me -- the software timers still wake the RTOS, so I'm unsure I've configured things correctly. I did not find any examples in "FreeRTOS/Demo" directory that illustrate tickless idle and software timers in use.

In my case: - FreeRTOS v9.0.0 - (configOVERRIDEDEFAULTTICKCONFIGURATION == 1) and (configUSETICKLESS_IDLE == 2) and I've defined the RTOS tick generated by RTC module at 128Hz. - I have 3 tasks and 2 software timers (running at 32Hz and 4Hz).

When my application has nothing to do the tasks enter the blocked state with portMAXDELAY timeout and portSUPPRESSTICKSANDSLEEP(xExpectedIdleTime) is called, where xExpectedIdleTime = 2.

(I have set configEXPECTEDIDLETIMEBEFORESLEEP == 2 so the RTOS will want to stop the ticks and enter sleep very quickly.)

With a short idle time -- likely because of the software timers -- the RTOS wakes after a short time, as one would expect. I can't realize the functionality described in the FreeRTOS version history (bold section above); logically it doesn't seem possible, but apparently it's implemented?

Perhaps I misinterpret the comment or missunderstand how to configure the tickless idle to work in conjunction with software timers? I did try disabling/enabling the software timers in the portPRESLEEPPROCESSING/portPOSTSLEEPPROCESSING but that was a bad idea!

Perhaps the comment in the version history is incorrect? It seems to contradict Software timers are not being used, so the scheduler is not due to execute a timer callback function at any time in the future. written here http://www.freertos.org/low-power-tickless-rtos.html

Could someone clarify?

Thanks! Bryce

Using Software Timers & Tickless Idle Mode

Posted by rtel on March 11, 2017

I think the change history note you refer to was in relation to allowing the tickless idle mode to be entered indefinitely EVEN WHEN software timers were used (i.e. configUSE_TIMERS is set to 1 in FreeRTOSConfig.h). Even when this is the case, software timers will still execute when they time out, even if tickless idle has activated and the MCU is in a low power state. It does not mean that software timers top executing when the tickless mode is entered. In other words the indefinite sleep will only be indefinite if there are no software timers due to expire, otherwise sleep mode will be exited when the software timer expires

Does that explanation help at all?

Using Software Timers & Tickless Idle Mode

Posted by bryce78 on March 13, 2017

Thanks! This explanation helps a lot!

[I did not know how indefinite sleep (tickless idle) was impacted by configUSE_TIMERS == 1 in earlier versions. Now I understand that the software enhancements were made to allow tickless idle even with this option set, but it doesn't mean the software timers will stop executing when tickless mode is entered.]

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists