the configuration of counter prescale of MPC5748G, STM module,

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

the configuration of counter prescale of MPC5748G, STM module,

1,994 次查看
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

标签 (1)
标记 (3)
3 回复数

1,638 次查看
shifeiqian
Contributor II

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

0 项奖励
回复

1,638 次查看
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

1,638 次查看
shifeiqian
Contributor II

Hi, b55689

I will try your method later.

Thank you very much!

Regards,

Qian

0 项奖励
回复