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.

ILLEGAL_ISR问题

专家您好:

      我同样的代码,在两块板子上做测试,两块板子的PCB完全相同,

发现一块正常,另一块运行时会进入到ILLEGAL_ISR()函数中,这块有问题的板子复位信号和电源信号都是正常的,

我想请问下:硬件上能触发ILLEGAL_ISR()的中断源有哪些?

  • Q: What causes an illegal (ITRAP) interrupt?

    • An invalid instruction is decoded (this includes invalid addressing modes).
    • The opcode value 0x0000 is decoded. This opcode corresponds to the ITRAP0 instruction.
    • The opcode value 0xFFFF is decoded. This opcode corresponds to the ITRAP1 instruction.
    • A 32-bit operation attempts to use the @SP register addressing mode.
    • Address mode setting AMODE=1 and PAGE0=1which is an illegal combination.

    Q: How can I debug an ITRAP?

    • An ITRAP is often a sign of stack overflowing or a buffer overflowing. To quickly see if it is the stack you can fill the region with a known value and then run the application. By the addresses written to you will be able to see how big the stack grew.
    • This application note has a method for using on-chip resources to detect when a stack overflow occurs: Online Stack Overflow Detection on the TMS320C28x DSP (spra820).
    • Make sure code isn't getting too close to the end of a valid memory block (which is followed by invalid memory). This is explained in the device errata.
    • Make sure the CPU is not pre-fetching into the code security password location.
    • Insert a return instruction into the ISR. Set a breakpoint on this instruction and then step to see where the code came from.
    • Another option is to look at the stack. When you take an illegal instruction trap, registers are automatically pushed on the stack, including the return address. By looking at the return address value on the stack, you can find out where the ITRAP occurred.

    另外,请检查下时钟、电源、复位等等外围电路。