Oleksiy Kasilov

Problem with Bus Clock uC MC9S08DZ60

Discussion created by Oleksiy Kasilov on Aug 2, 2010
Latest reply on Aug 11, 2010 by Ingo Kauf

Hi all! 

I have recently faced a very strange problem. I have a tiny piece of code which initializes a TMP2 module as real time clock and toggles a led in ISR of the timer.  The clock source for the timer is Bus Clock (20Mhz). 


I run this code on two identical harware. On the first one it runs without any problem as expected. Whereas on the second one the LED toggles with frequency about 10 lower than it should be... I have no idea what is happening.


I compared in the debugger the registers which are responsible for clock settings on both HWs: MCGC1, MCGC2, MCGTRM, MCGSC, MCGC3. They are identically initialized. Moreover this code used to run on both HWs without any problems.


Can you help me with any hints how this is possible?  My feeling that flash programmer does some **bleep** with registers but not completely sure.  

Thank you for your help.