Lab 5: System Initialization
Run the Code – Watchdog Reset
9. Place the cursor on the first line of code in main() and set a breakpoint by right
clicking the mouse key and select Toggle breakpoint. Notice that line is
highlighted with a red dot indicating that the breakpoint has been set.
10. Single-step your code into the “main loop” section and watch the lines of code
execute. If you don’t want to see each line execute, place the cursor in the “main
loop” section (on the asm(“ NOP”); instruction line) and right click the mouse key
and select Run To Cursor. This is the same as setting a breakpoint on the selected
line, running to that breakpoint, and then removing the breakpoint.
11. Run your code for a few seconds by using the <F5> key, or using the Run button on the
vertical toolbar, or using Debug Run on the menu bar. After a few seconds halt
your code by using Shift <F5>, or the Halt button on the vertical toolbar. Where did your
code stop? Are the results as expected? If things went as expected, your code should be
in the “main loop”.
12. Modify the InitSysCtrl() function to enable the watchdog (WDCR). This will
enable the watchdog to function and cause a reset. Save the file and click the “Build”
button. Then reset the DSP by clicking on Debug Reset CPU. Under Debug on
the menu bar click “Go Main”.
13. Place the cusor in the “main loop” section, right click the mouse key and select
Run To Cursor.
14. Run your code. Where did your code stop? Are the results as expected? If things went
as expected, your code should stop at the breakpoint.
Setup PIE Vector for Watchdog Interrupt
The first part of this lab exercise used the watchdog to generate a CPU reset. This was tested
using a breakpoint set at the beginning of main(). Next, we are going to use the watchdog
to generate an interrupt. This part will demonstrate the interrupt concepts learned in the
previous module.
15. Add the following files to the project:
PieCtrl_5_6_7_8_9.c
DefaultIsr_5_6_7.c
Check your files list to make sure the files are there.
16. In Main_5.c, add code to call the InitPieCtrl() function. There are no passed
parameters or return values, so the call code is simply:
InitPieCtrl();
17. Using the “PIE Interrupt Assignment Table” shown in the previous module find the
location for the watchdog interrupt, “WAKEINT”.
C28x - System Initialization 5 - 17