the configuration of counter prescale of MPC5748G, STM module,

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

the configuration of counter prescale of MPC5748G, STM module,

1,279 Views
shifeiqian
Contributor II

Dear Sir. or Mandam,

 

I have some problem in the the configuration of counter prescale of MPC5748G, STM module, attached is my project and the serial debugging assistant that will be used in my project.

 

In my project, STM_0 is enabled. STM_0.CNT.R increments at the frequency of the system clock, the compare value is set to 0x77359400. When STM_0.CNT.R matches the compare value, an interrupt will be inserted and LED1 will be turned on, "the channel compare register matches the timer counter" will be displayed in the serial debugging assistant.

 

However, if you step into STM_Init(&STM_0,&sSTMConfig1) in main.c,

 

159579_159579.png1.png

then uncomment the "STM_Counter_Prescaler(pSTM, (config->counter).CounterPrescaler);" which set the devide value for the prescaler,

159580_159580.png3.png

then the program will stop at this line while debugging.

Original Attachment has been moved to: mpc5748g_Z4_1.rar

Labels (1)
3 Replies

923 Views
shifeiqian
Contributor II

Could you please help me to find out what's wrong it is? Thank you very much!

0 Kudos

923 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

you must not use bit access to write to STM registers.

pastedImage_0.png

You have to use pSTM->CR.R = 0x00000101; instead of pSTM->CR.B.CPS=to_set;

Regards,

Martin

923 Views
shifeiqian
Contributor II

Hi, b55689

I will try your method later.

Thank you very much!

Regards,

Qian

0 Kudos