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


STM32, problem with tickless idle mode

Posted by Jakub on July 19, 2013
I try to implement tickless idle mode in STM32F103 as in example configuration at http://www.freertos.org/low-power-tickless-rtos.html I get some good results - it's working, but not exactly as I wanted: the ticks period is about 150ms (I computed that it can be max 233ms with my configuration (CPU core clock 72MHz, SysTick clock -> the same, TickRate 1000Hz)). The additional timer used to generate interrupt is RTC.
These are my implementations of functions from example:

unsigned long ulGetExternalTime(void)
/* Wait for RTC registers synchronization */
/* Wait until last write operation on RTC registers has finished */
return RTC_GetCounter();

void prvStopTickInterruptTimer(void)
portNVIC_SYSTICK_CTRL_REG &= ~0x00000002;

void prvStartTickInterruptTimer(void)
/* Disable the RTC ALARM */
/* Wait until last write operation on RTC registers has finished */
portNVIC_SYSTICK_CTRL_REG |= 0x00000002;

void vSetWakeTimeInterrupt( portTickType xExpectedIdleTime )
while( RTC_GetFlagStatus( RTC_FLAG_SEC ) == RESET )
RTC_SetAlarm(RTC_GetCounter() + xExpectedIdleTime);
/* Enable the RTC Alarm */

Additionally, RTC is clocked with external 32768Hz oscillator, its prescaler is set to 32
Does anybody has any ideas what's wrong?

*sorry for my English, i realize it's not very good

RE: STM32, problem with tickless idle mode

Posted by Jakub on July 19, 2013
I forgot it:
when I changed prvStopTickInterrupt to disable SysTick timer interrupts and disable counter too, the tick period grew to about 30ms.
Apart of them, I can see on the osciloscope that the tick occurs every 150ms but it toggles four times...

RE: STM32, problem with tickless idle mode

Posted by Richard on July 19, 2013
Sorry, I'm not sure what you are saying is wrong. Is it just that the tick period is incorrect (you try to set the tick period to generate a certain frequency, but the frequency achieved is not what you intended)? Or is it something specific to turning the tick on and off that is wrong?

Unfortunately I can't comment on chip or peripheral specific configurations as there are just too many chips and peripherals out there to be familiar with all of them.

Are you trying to use both the SysTick timer and the RTC? So using SysTick during normal operation and the RTC when you turn the tick off?


RE: STM32, problem with tickless idle mode

Posted by Jakub on July 19, 2013
Yes, I try to use SysTick during normal operation and the RTC when tick is turn off.
But the problem seems to be with hardware configuration, not with my (mis)understanding of the FreeRTOS :) so i try to deal with it myself.

RE: STM32, problem with tickless idle mode

Posted by Jakub on July 22, 2013
hmm, I noticed some strange things:
1) as i said, i've got 2 tasks, both blink led. I don't change any configuration parameters. When I run default implementation of tickless idle mode, the condition
if( eTaskConfirmSleepModeStatus() == eAbortSleep )
is never true. In my implementation (made from example from http://www.freertos.org/low-power-tickless-rtos.html) this condition is true very often.

2. Another strange thing - change of configTICK_RATE_HZ from 1000Hz to 993Hz makes my tickless period (in my own implementation) around 2x longer. And i haven't a clue why...

RE: STM32, problem with tickless idle mode

Posted by Jakub on July 22, 2013
and another thing:
When in function prvStopTickInterruptTimer ( and prvStartTickInterruptTimer ) I only turn off interrupts from SysTick timer the tickless period is 5x longer than when I turn off interrupts and disable a counter too.

[ 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