Hi
I have a problem on a LPC2478 where if I keep transmiting the same data to both UART0 and UART2 at the same time very soon the micro will crash with a prefetch Abort error raised. I beleive this is caused by two different UART transmit interrupts being active at once.
If I transmit the data to just UART0 or UART2 individually then there is never a problem.
I am not intentionally using nested interrupts but I suspect this may be the problem. Can I turn this off as I don't need nested interrupts? or is this off by default and I would need to extra code for nested interrupts.
I also assume the prefetch Abort error can be caused by a stack corruption, is there a way to get a trace of everything up to this error using Keil uVision4?
Any help or suggestions would be appreciated.
Regards Simon
Is your startup code correctly written to support reentrant interrupts? The "normal" startup file + code generated by the compiler isn't enough to correctly handle nested interrupts, unless it's a normal ISR that gets interrupted by a FIQ.
My startup code file is LPC2400.s which is the "normal" code generated by the Keil MDK-ARM compiler when creating a new project. There is nothing in there that I am aware of to do with nesting interrupts.
As I don't need nested interrupts is there a way to turn this off for LPX24xx micros? I cannot see any reference to nested interrupts in the micro datasheet.
I would like one UART interrupt to transmit its data and if the other UART transmit interrupt occurs during that time it does not interfer with the first interrupt regarless of its interrupt priority. Is this possible?
If nested interrupts is something that will always happen and has to be coded for can anyone point me in the right direction for a working Keil example? The few examples I have found on the internet using inline assembler do not compile.
a guess: you have both ISRs calling something common where a flag or some such screws up when both call. ISRs by definition call something '(module) global' or they caould not communicate with the main code
I thought common flag also and I have already renamed everything so that the code uses variable names specific to each UART.
I'll try removing all code within the interrupt tomorrow and keep it simple so each UART just sends out the same character each time to see if there is some common variable problem across both UARTS.
"My startup code file is LPC2400.s which is the "normal" code generated by the Keil MDK-ARM compiler when creating a new project. There is nothing in there that I am aware of to do with nesting interrupts.
As I don't need nested interrupts is there a way to turn this off for LPX24xx micros? I cannot see any reference to nested interrupts in the micro datasheet."
Keil have sample code for the assembler part required for handling nested interrupts. Not sure but it might be written for the LPC21xx processor architecture but the concept is the same.
But it isn't needed unless your ISR happens to enable interrupts which would allow other interrupts of same or higher priority to step in before the first ISR ends. As long as the ISR doesn't enable interrupts, only the FIQ can step in. And since the FIQ has its own stack, there aren't any need for any special assembler code to support a FIQ nesting on top of an IRQ.
But with IRQ nesting with IRQ, the standard code will not manage to properly save all registers - it will only save the registers that is shared with the "main-loop" registers.