This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM42L432: undefEntry when using critical sections in interrupt handler

Part Number: RM42L432
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am porting a project from STM32 that is using some external peripherals. My problem boils down to this:

In interrupt handler that is caused by gioNotification from external peripheral i have to communicate through SPI. To do this, I have to enter/exit critical section. When exiting critical section I get undefEntry (program stuck at line 4).

resetEntry
        b   _c_int00
undefEntry
        b   undefEntry
svcEntry
        b   svcEntry
prefetchEntry
        b   prefetchEntry
        b   _dabort
        b   phantomInterrupt
        ldr pc,[pc,#-0x1b0]
        ldr pc,[pc,#-0x1b0]

So my problem would look like:

void gioNotification(gioPORT_t *port, uint32 bit) {
   //code
ENTER_CRITICAL();
//communicate
EXIT_CRITICAL();
//code }

and the error occurs at EXIT_CRITICAL();

As EXIT_CRITICAL() I used:

1. _enable_interrupts();
2. _enable_IRQ();
3.  asm(" cpsie i ");

Of course ENTER_CRITICAL() uses complementary functions at the same time.

All with the same result.

1. I am not using FIQ at the moment

2. It doesn't seem that the same or any other pending interrupt fires when executing EXIT_CRITICAL(), it just goes straight to undefEntry.

3. I used HalcoGen to generate config code. I did not change much with regards to interrupt handling except enabling them.

Does anybody have a clue?

  • Hello,
    Hercules does not support nested interrupts. While IRQ is serviced no other IRQ can interrupt the CPU. Only FIQ can interrupt IRQ. While FIQ is serviced no other FIQ or IRQ can interrupt the CPU. When the CPU receives an interrupt request, the CPSR mode field changes to either FIQ or IRQ mode. When an IRQ interrupt is received, the CPU disables other IRQ interrupts. When an FIQ interrupt is received, the CPU disables both IRQ and FIQ interrupt. After ISR is finished then IRQs are enabled again. "_enable_interrupts()" enables both IRQ and FIQ. "_enable_IRQ" enables only IRQ.

    Best regards,
    Miro
  • I am aware that nested interrupts are not supported. However I am using 3rd party library to communicate to peripheral, that uses critical sections. I wouldn't want to redo the communication if I don't need to. I am also aware of the differences between the _enable*** functions. Is calling _enable_interrupts() in interrupt handler impossible in RM42?
  • Hello,
    The processor takes the undefined instruction exception when it encounters an instruction that is undefined in the appropriate version of the ARM instruction set, or which is for the VFP when the VFP is disabled.

    Best regards,
    Miro