Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

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.