Problem with Bus Clock uC MC9S08DZ60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Bus Clock uC MC9S08DZ60

851 Views
akasilov
Contributor I

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.

Labels (1)
0 Kudos
3 Replies

373 Views
J2MEJediMaster
Specialist I

Thus is just a wild guess, but since you have identical hardware using the same code, yet one board appears to operate at a slower rate: have you checked the jumpers on the boards? Maybe one board is jumpered for a different clock frequency?

 

---Tom

0 Kudos

373 Views
akasilov
Contributor I

there are no jumpers. its our custom designed hardware. In fact I have four boards. On two of them it runs and on two this problem occurs. The only thing I noticed is that two that work properly have uC MC9S08DZ60 MHL the ones which dont work have uC MC9S08DZ60 AMHL. Yesterday I replaced the uC on one of the not working ones with MHL version and it works. 

So it seems I am facing some strange bug of AMHL version. But what is really interesting is that ALL hardwares used to work before. Looks like something in AMHL versions broke down after some time..  

0 Kudos

373 Views
i_kauf
Contributor III

Hello alex!

 

Do you use a crystal on you board? It could be that a crystal drift in center frequency if the enviroment temperture change.

I often seen this in paging transmitters if crystal oven does not work.

 

regards,

 

Ingo

0 Kudos