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


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 ]    [ 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