AnsweredAssumed Answered

TC5 Interrupt and WAI instruction problem

Question asked by Daniel ONeill on Feb 1, 2010
Latest reply on Feb 2, 2010 by Daniel ONeill

I am porting an existing HC11 assembly language application to the MC9S12X512DT. So far I have only enabled the Time of Day interrupt using TCNT and the TC5 output compare function. The first two interrupts occur and process properly. The application encounters the WAI instruction before the next interrupt can occur. A 3rd interrupt occurs while in the wait state and processes properly. Before the 4th interrupt occurs, the same WAI instruction is encountered. This time the application hangs in the wait state as it appears that the TOD interrupt has ceased to function.


I am using an in circuit emulator for debugging. I set breakpoints for both the TOD interrupt vector and the WAI instruction. When the 1st WAI instruction is encountered, the ICE breaks. If I step the ICE, it goes right to the TOD vector (as expected). When the 2nd WAI instruction is encountered, I do the same thing. However, this time the ICE hangs up and it requires a reset to recover, which wipes out all of the CPU register states that might have held some useful information.


I can change clock pre-scalars so that the interrupts occur more frequently which causes the failure mode to occur after the 6th or 12th interrupt. 


Once again, this is an existing application that runs fine on the HC11 platform, which tells me that I'm likely doing something wrong in the CPU configuration.