I am using Processor Expert in Code Warrior Classic version 5.1 with a MC9S12XS256 processor. Processor Expert is version 3.02
I have used Processor Expert to create a 1ms timer, using the Periodic Interrupt Time 0. (These are modulus down counters, as described in chapter 12 of the Freescale manual for the device).
I want to freeze this timer when I reach a break point during debugging.
According to the manual, there is a flag in register PITCFLMT called PITFRZ. The manual says "When during debugging a breakpoint (freeze mode) is encountered it is useful in many cases to freeze the PIT counters to avoid e.g. interrupt generation. The PITFRZ bit controls the PIT operation while in freeze mode.
0 PIT operates normally in freeze mode
1 PIT counters are stalled when in freeze mode
In Processor Expert, if I look at the EXPERT view of the Timer Properties, there is a property called "Stop in Freeze Mode". See attached Image. I set this to yes, but the generated code does not set the PITFRZ flag in this register.
Also if I click on the "View Regs>" button to view the registers, the PITFRZ flag is shown as zero in that display.
Is there some other option I am meant to set to make this work? It is an annoyance in debugging as I cannot step through the code. The way round is to remember to manually change this flag at the start of each debugging session, but that is not an elegant solution.
Apologies for the typing error - the title should read "Freeze Mode".
Hello Steve,
I have reproduced the issue, it is indeed a problem in Processor Expert, the PITFRZ bit is not initialized properly. Thank you for reporting it.
As a workaround, you can try setting the bit in user code. This way you don't need to remember to set it in the debugger for every debug session. You can do this in the beginning of the main() function, before the call to PE_low_level_init(). PE_low_level_init() will only modify the PITCFLMT register in a read-modify-write fashion, so it will not overwrite your setting.
Best regards,
Cristian
Hi Cristian
Thanks for your reply - I thought it was my mistake.
In fact I had put the following lines directly after the call to PE_low_level_init();
/* Fix annoying timer interrupt when debugging */ | |
setReg8Bits(PITCFLMT, 0xA0U); |
It just wasn't elegant!
Best regards
Steve