常見問題
  • If a subroutine is called in an interrupt function that disables multiple interrupts, and another interrupt is entered after the interrupt is enabled in that subroutine, a WDT interrupt will occur. Why is this behavior happening?
    • When a maskable interrupt occurs, the return address from the interrupt is transferred to the ELR register. When returning from an interrupt, use the RTI instruction to transfer the contents of the ELR register to the PC and return to the processing before interrupt. On the other hand, in a function that enables multiple interrupt, the ELR is saved to the stack at the beginning of the function to protect the value of the ELR register when multiple interrupt occur, and the ELR is returned to the PC by POP PC instruction at the end of the function. When an interrupt is occurred by enabling an interrupt with a function that disables multiple interrupt, the ELR register is overwritten with the address in the interrupt function. Therefore, even if the RTI instruction is executed, the address in the interrupt function is returned to, and the interrupt processing cannot be exited. As a result, the WDT counter is not cleared and a WDT reset occurs. When enabling multiple interrupt in this way, it is necessary to protect the value of the ELR register. If category 2 of #pragma interrupt is specified for the interrupt function, these processes are added. For interrupts, see "1.3.7 Interrupt Operation" and "1.4 Exception Levels and Backup Registers" in the "nX-U16/100 Core Instruction Manual".
    • Products: General-purpose MCUs (16bit)