Quality RTOS & Embedded Software

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


Periodic Reset - Interrupt Problem ?

Posted by damien h on July 7, 2008

Hi everybody,

Well, i have a problem with FreeRTOS 5.0.0 running on a ARM9 STR912, compilation GCC Yagarto /Eclipse (GCC Port provided by Richard, thanks to him).

After a long time of running (could be 3-4-6 hours), my processor reset by itself.
I m (fairly) sure it's not a problem of stack overflow because i'm monitoring periodically the free memory available via the "water level" (0xa5 in the stack) and i m always with at least 300 bytes free for each task running (5 in fact).

Inside my application, I m using the timer 0 to tick FreeRTOS (1KHz) and i m using also the RTC interrupt.

In my RTC interrupt event, I m NOT using following function, Is it right ?

(save /restore context is done directly in the assemblary file just before / after branch the interrupt)

Note : Nothing is defined with the keyword __naked__.

Thanks in advance.

My interrupt :

void RTC_IRQHandler(void)
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

/* Not necessary to save context-> done in assemblary file*/

/* disable interrupt */

/* "Unblock" the task of analog measurement */
xSemaphoreGiveFromISR( xSemaphoreAnalogMeasurement, &xHigherPriorityTaskWoken );

/*new interrupt*/

/* Not necessary to restore context -> done in assemblary file*/
/* Not necessary to write in VIC, done in assemblary*/


RE: Periodic Reset - Interrupt Problem ?

Posted by Richard on July 7, 2008
I suspect the saving and restoring of the context will be done within a single IRQ interrupt entry point, before calling the individual handler. This is how the IAR version works. Hence the handler itself is just a standard C function without the naked attribute.


RE: Periodic Reset - Interrupt Problem ?

Posted by damien h on July 8, 2008
Thanks for your reply Richard.

Yes, you are true, the GCC Port is the same construction than the IAR port.

BUT Yesterday i disabled my RTC interrupt (for polling FreeRTOS kernel tick), and my software is able to run without crash during a full day.

I except I have a problem when my RTC Interrupt fire and the RTOS is already in the TIM0 interrupt (this timer is used by RTOS to generate kernel tick). Or the opposite : TIM0 fire when i m in the RTC interrupt.

Any idea is welcome !


RE: Periodic Reset - Interrupt Problem ?

Posted by Anis Ben Abdallah on July 13, 2008
Hi Damien,

The interrupt management on the STR912 is a little bit tricky. I advice you to have a look at an application note on the stmcu website which is " STR912 interrupt management".

The implementation of the interrupt controller on the STR9 is very particular: it is based on 2 daisy chained ARM VICs and you have interrupts which are mapped to VIC0 and other to VIC1 with VIC0 interrupts having higher priority.

I don't like to enter too much in details ( you can have a look at the AN), but I think what you are seeing is the result of a bad interrupt management.


RE: Periodic Reset - Interrupt Problem ?

Posted by damien h on July 14, 2008
Hi Anis, and others

Thanks for your repplies,

I found the problem : Anis was half right, this is a problem of interrupt but not in my RTC interrupt or Timer interrupt but with SPURIOUS interrupt.
Answer is given in the document: (thanks Anis)
http://www.st.com/stonline/products/literature/an/13715.pdf, page 11.

Because I hadn't assigned a new default vector in the VIC0-1, during a spurious interrupt my software was branching to 0x00000000 means reset vector.

Just by adding following lines: everything seems fixed.

VIC0->DVAR = (u32)Dummy_Handler;
VIC1->DVAR = (u32)Dummy_Handler;

Thanks all.


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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner