AnsweredAssumed Answered

Coldfire : timer reset every 256 ms.

Question asked by Adrien Segura on Jun 17, 2019
Latest reply on Jun 20, 2019 by TomE

Hi,

I use Codewarrior 10.6 with a coldifre MCF51CN128 and a multilink universal , and, when i use my 100 ms timer (defined well), it resets at 256 ms : here i toggle a led every 100 ms using that timer :

as you can see , it stays 150 ms high instead of 100ms.The problem seems to come from a reset of the module after 256 ms.

my code looks like this :

 

TPM2CNT = 0 ;        
TPM2SC_TOF = 0 ;
TPM2SC_CLKSx = 0x2;     //start 100 ms timer

 

LedBusy = 1 ;   // led set to high

 

while (TPM2SC_TOF != 1 ){}   // wait for the timer to end

TPM2SC_TOF = 0 ;   //clear flag

TPM2SC_CLKSx = 0 ;   //stop timer

 

LedBusy = 0 ;    // led set to low

 

TPM2CNT = 0 ; 
TPM2SC_TOF = 0 ; 
TPM2SC_CLKSx = 0x2;     //start 100 ms timer

 

while (TPM2SC_TOF != 1 ){}      // wait for the timer to end

TPM2SC_TOF = 0 ;    //clear flag

TPM2SC_CLKSx = 0 ;

 

any ideas of what could be the problem? thanks for your help !

 

Adrien Segura

Outcomes