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




Loading

FreeRTOS timer not stopping

Posted by ksoldavin on November 16, 2016

I am having an issue with my timer code under FreeRTOS v9.0 using an STM32F4. I am trying to create a one shot timer with a period of 1000mS. The timer is being activated correctly and the callback function is being run, but after it has finished it is repeatedly called again 1000mS later.

My timer is being set up as follows: ~~~ static void SerialTimerCallback( TimerHandlet pxExpiredTimer ); static TimerHandlet SerialTimerHandle = NULL;

SerialTimerHandle = xTimerCreate("Video DMA Timer", 1000, pdFALSE, ( void * ) 123, SerialTimerCallback );

static void SerialTimerCallback( TimerHandle_t pxExpiredTimer ) { printf("Timer expiredn"); // Do other stuff } ~~~

I have also tried making the timer auto reload and calling the stop timer command in my callback with the same result.

Any suggestions?

Thank you Keith


FreeRTOS timer not stopping

Posted by rtel on November 16, 2016

I've never come across that symptom before. Is anything else using the SerialTimerHandle handle in any way? Could it be accidentally reset by any other code? Where is xTimerCreate() being called from? Could it be accidentally created more than once?


FreeRTOS timer not stopping

Posted by ksoldavin on November 17, 2016

Thank you for responding. The timer is being created in my init code that is efinately only run once. Aside from that I have code that checks if SerialTimerHandle is NULL and only tries to create it if it is. I just looked over my code and the only place the timer is touched is when it is initialized.

Keith


FreeRTOS timer not stopping

Posted by rtel on November 17, 2016

This is very odd, and perhaps it is a simple data corruption that has effected the timer's structure.

Place a break point on the function prvProcessExpiredTimer(), which is in FreeRTOS/Source/timers.c. The break point will get hit when your timer expires. Step through the function and see what happens - there is a line "if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE )" - if it goes through there then the timer thinks it is an auto reload timer. If that is the case it would indeed seem to have been corrupted - in which case restart the application and step through the code that creates the timer. pxTimer->uxAutoReload should get set to pdFALSE (0) - does it? If it does then you will have to try and catch the place where it gets overwritten - the easiest way of doing that would be to put a data watchpoint on the pxTimer->uxAutoReload memory address that will automatically stop the code when that memory address gets written to.


[ 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