the configuration of counter prescale of MPC5748G, STM module,

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

the configuration of counter prescale of MPC5748G, STM module,

1,849件の閲覧回数
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,493件の閲覧回数
shifeiqian
Contributor II

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

0 件の賞賛
返信

1,493件の閲覧回数
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,493件の閲覧回数
shifeiqian
Contributor II

Hi, b55689

I will try your method later.

Thank you very much!

Regards,

Qian

0 件の賞賛
返信