Lab 5: System Initialization
TMS320F2837xD Microcontroller Workshop - System Initialization 5 - 27
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.
23. Add (copy) the following files to the project from C:\C28x\Labs\Lab5\source:
DefaultIsr_5.c
PieCtrl.c
PieVect.c
Check your files list to make sure the files are there.
24. 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();
25. Using the “PIE Interrupt Assignment Table” shown in the previous module find the
location for the watchdog interrupt, “WAKE”. This will be used in the next step.
PIE group #: # within group:
26. Modify main() to do the following:
- Enable global interrupts (INTM bit)
Then modify InitWatchdog() to do the following:
- Enable the “WAKE” interrupt in the PIE (Hint: use the PieCtrlRegs structure)
- Enable the appropriate core interrupt in the IER register
27. In Watchdog.c modify the system control and status register (SCSR) to cause the
watchdog to generate a WAKE interrupt rather than a reset. Save all changes to the
files.
28. Open and inspect DefaultIsr_5.c. This file contains interrupt service routines. The
ISR for WAKE interrupt has been trapped by an emulation breakpoint contained in an
inline assembly statement using “ESTOP0”. This gives the same results as placing a
breakpoint in the ISR. We will run the lab exercise as before, except this time the
watchdog will generate an interrupt. If the registers have been configured properly, the
code will be trapped in the ISR.
29. Open and inspect PieCtrl.c. This file is used to initialize the PIE RAM and enable the
PIE. The interrupt vector table located in PieVect.c is copied to the PIE RAM to setup
the vectors for the interrupts.
Build and Load
30. Build the project by clicking Project Build Project, or by clicking on the
“Build” button (if it has been added to the tool bar). Select Yes to “Reload the program
automatically”.