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


Late Timer Expiration: STM32L1xx

Posted by paulromero on January 12, 2015

Hi Folks:

I am using FreeRTOS on STM32L15RD processor--a STM32L152 variant, and using the Rowley Crossworks for ARM as a toolchain. My problem is when a I set a timer for what I think is 10000 milliseconds it doesn't expire until approximately 17000 milliseconds.

The timer is created as follows:

TSAMPLE = xTimerCreate("Sample T", (10000/portTICKRATEMS), pdFALSE, &v, samplehandler);

The underlying definition of portTICKRATEMS in FreeRtosConfig.h is as follows:

define configTICKRATEHZ ( (TickTypeT) 1000)

This is the timeout handler.

void samplehandler(TimerHandlert timerid) { TLPMESSAGE msg;

msg.data_len = 0;
msg.data = NULL;
xQueueSendToFront(AGGREGATE_TASK, &msg, portMAX_DELAY);



The timer is started and handled in AGGREGATE_TASK and the only thing the task is doing is waiting for a message as follows: (i.e. No messages except the timeout message arrive.)

xQueueReceive(AGGREGATE_TASK, &msg, 0);

Do you have any idea what the problem is ?

Best Regards,

Paul R.

Late Timer Expiration: STM32L1xx

Posted by rtel on January 12, 2015

xQueueSendToFront(AGGREGATETASK, &msg, portMAXDELAY);

You are not supposed to make any Blocking function calls in timers, as to do so will Block the timer task itself, and effect any other timers that might be running. That may be the cause of the problem, but also....

Are you sure the tick interrupt is executing at the frequency you think it is? Can you toggle a pin from a tick hook function and check its frequency on a scope or frequency meter?


Late Timer Expiration: STM32L1xx

Posted by paulromero on January 12, 2015


I don't think that is the problem becuase if one substibutes xQueueSendToFrontFromISR(), the problem persists. In any case, the queueing functions don't do much more than a linked list insertion.

Best Regards,

Paul R.

Late Timer Expiration: STM32L1xx

Posted by paulromero on January 13, 2015

Hi Folks:

I don't have a scope handy but is is possible the clock is not configured as I think. The file with the clock initialization routines is attached to this note.

Best Regards,

Paul R.


system_stm32l1xx.c (19641 bytes)

Late Timer Expiration: STM32L1xx

Posted by rtel on January 13, 2015

I'm afraid the configuration of microcontrollers falls outside of FreeRTOS support. Even toggling an LED once per second and timing 60 toggles will give you a gross assessment of how the frequency of the tick count. Also ST provide a spreadsheet that automates clock configuration - you can enter your settings into the spread sheet and it will tell you the frequency of the output clocks.


[ 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