NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

Debugging an illegal address (NMI) problem on C24xx devices

From Texas Instruments Wiki
Jump to: navigation, search

The NMI cannot be debugged by simply stepping through your code and watch for the NMI to occur since all interrupts (including NMI) are disabled by the debugger in single-step mode. You must Run the code and let the NMI occur. In order to identify the part of your code that is causing the NMI, do the following.

1. Reset the DSP

2. Run your code and halt it after few seconds. Your code should be trapped at the NMI vector.

3. Open the CPU window in Code Composer so you can see the contents of the TOS by clicking View ---> CPU Registers ---> CPU Register.

Notice the contents of the TOS (Top Of Stack) register. This is the return address placed on the hardware stack when the NMI interrupt occured. Now Scroll through the Diassembly Window to the address indicated by the TOS to see the code that is causing the NMI.

Please keep in mind that the code will clear the pipeline before the interrupt is taken. For example, lets say, SPLK instruction causes the illegal address violation and it will cause this violation in the Execute phase of the pipeline. However, the next 3 instructions are already in process in the pipeline (i.e FETCH, DECODE, and READ pipeline phases), and they continue through to execute before the interrupt occurs. Therefore, the TOS register will be pointing to the fourth address after the address location that contains faulty code.