Hello. I'm trying to implement the Serial Bootloader for S12(X) AN4258 using a S12GA240/S12G240 microcontroller. We have an external watchdog which needs to be reset every 1o to 50 ms. I would like to use the timer interrupt module to set the external watchdog. I have this working on my main application code, not the bootloader though. I'm not able to do this right now, so the micro keeps getting reset. I'm trying to implement the watchdog reset without the interrupt and it will most likely work but using the timer interrupt module would be much easier.
Below is my code for setting up the timer interrupt module. We have a 8MHz resonator. Bus speed is set to 16MHz.
// Function to configure the timer interrupt module
// Configuration for timer overflow interrupt
TSCR1_PRNT = 0; // Enable legacy timer. PR0, PR1, and PR2 bits of the TSCR2 register are used for timer counter prescaler selection.
TSCR1_TFFCA = 0; // Allow the timer flag clearing to function normally
TSCR1_TSFRZ = 0; // Allow the timer counter to continue running while in freeze mode
TSCR1_TSWAI = 0; // Allow the timer module to continue running during wait
TSCR1_TEN = 1; // Enable timer
// Timer Clock Selection
// Timer Clock = Bus Clock / 1
TSCR2_PR2 = 0;
TSCR2_PR1 = 0;
TSCR2_PR0 = 0;
TSCR2_TOI = 1; // Enable timer overflow interrupt
TFLG2 = 0x80; // Clear timer interrupt flag
interrupt void TOI_ISR(void)
TFLG2 = 0x80; // Clear interrupt flag
If anyone can provide some helpful information I would appreciate it. Thank You.