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
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).
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?
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).
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.
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.