Quality RTOS & Embedded Software

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


AT91SAM7S256 + GCC + Interrupts Problem

Posted by Sebastian K on March 11, 2010
Hello everybody.
Im using FreeRTOS in such configuration: at91sam7s256 + arm-none-eabi-compiler + Eclipse + jtagkey. Im using in my project two interrupt driven usarts (ISRs are declared as naked). One usart is for Modbus, another one for other protocol called LonWorks (im trying to develop kind of gateway between these two protocols). The problem I encountered is,that after some time of running with no problems, suddenly all interrupts are disabled (from usarts and PIT interrupt), so my application is still runnig but the context switching is not performing and program stack in one task and round indefinetely in this task. No prefetch abort, no data abort. I am sure that there is no stack overflow, because i checked this. I thought that such behaviour can be caused by portENTER_CRITICAL and portEXIT_CRITICAL macros, but i comments line witch them and the problem still exists. maybe somoone had also encountered such problem and is able to help me or at least could told me where to find origin of problem.
Thanks in advance

RE: AT91SAM7S256 + GCC + Interrupts Problem

Posted by Sebastian K on March 11, 2010
I've forgot to add, that before commenting line witch portENTER_CRITICAL and portEXIT_CRITICAL the interrupts were not enabling also if program was executing macro portEXIT_CRITICAL (i checked this using jtag and i am sure that asssembler code responsible for enabling interrupts was executing).

RE: AT91SAM7S256 + GCC + Interrupts Problem

Posted by Dave on March 11, 2010
When the problem happens, check the value of ulCriticalNesting. If you are not in a critical section then it should be 0.

You say you declare the interrupt functions naked. Are you using the assembly wrappers for the interrupt functions, so the interrupt is entered through a wrapper that saves the context before calling a C function to do the actual interrupt processing?

RE: AT91SAM7S256 + GCC + Interrupts Problem

Posted by Sebastian K on March 11, 2010
Yes of course there are wrappers to ISRs to both usarts and ulCriticalNesting is equal to 0 when the problem occurs. Through JTAG i can check my cpsr register value and is euqal to 1000000000000000000000000111111 (this is value checked when all interrupts are disabled so the program is stack in one task).

RE: AT91SAM7S256 + GCC + Interrupts Problem

Posted by Sebastian K on March 16, 2010
This is me again. I have a question if it is possible, that too long interrupt service routine of USART can cause disabling all interrupts (probably not, i cant realize such situation), i think the only effect of too long ISR is missinig some interrupts form USART. I checked my program, and problem of disabling all interrupts is caused by only one task. I have to taks and two ISR for USARTs. Both task are the same priority and when i send frames to one MODBUS task, system works perfect, but when i start to send frames to other task (second USART) after some time interrupts are disabled and program is getting stack in this task.

RE: AT91SAM7S256 + GCC + Interrupts Problem

Posted by Sebastian K on March 19, 2010
Hello again
I solved the problem. It was my fault beacuse I build ISR functions to one of usarts in wrong way. I had enabled interrupts from RXREADY, TXEMPTY, PARITY_ERROR, BUFFER_OVERRUN and FRAME_ERROR and in ISR when i checked for last three mentioned interrupts i return from ISR without writing to AT91C_BASE_AIC->AIC_EOICR, so when I send lots of messages to my hardware i probalby trigger BUFFER_OVERRUN interrupt and this caused problem with disabling all interrupts.

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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

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

Cadence Tensilica Cortes

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