Quality RTOS & Embedded Software

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




Loading

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.event = AGG_E_SAMPLE_TIMEOUT;
msg.data_len = 0;
msg.data = NULL;
xQueueSendToFront(AGGREGATE_TASK, &msg, portMAX_DELAY);

return;

}

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?

Regards.


Late Timer Expiration: STM32L1xx

Posted by paulromero on January 12, 2015

Hi:

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.

Attachments

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.

Regards.


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS