How to initialize the module eTimer in MPC5604P

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

How to initialize the module eTimer in MPC5604P

1,738 次查看
ananan
Contributor III

时钟.jpg

初始化.jpg

these are my initialization of the module eTimer in the MPC5604.I want to use the module about the PWM function。but after enable the ENBL register ,the value of CNTR is not change.I do not kown how to use the module eTimer。please help me!My English is not good,forgive me。

ananan

标签 (1)
3 回复数

1,595 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you need to select Primary Count Source to be Peripheral clock, e.g.

ETIMER_1.CHANNEL[4].CTRL.B.PRISRC = 0x18;

If you want to have COMPx preloaded with COMPLDx then set the CCCTRL register

/* COMP1/COMP2 register is used when the counter is counting up.
       Load COMP2 with CMPLD2 upon successful compare with the value in COMP2.
       Load COMP1 with CMPLD1 upon successful compare with the value in COMP1.     */
ETIMER_1.CHANNEL[4].CCCTRL.R = 0xA800;

BR, Petr

1,595 次查看
ananan
Contributor III

thank you very much!it is work!and I have a another quiestion 。how can I control the pulse 

frequency and calculate from the COMP1、COMP2 and the PLL clock?
0 项奖励
回复

1,595 次查看
PetrS
NXP TechSupport
NXP TechSupport

The frequency of the PWM signal is calculated as

freq = MC_PLL_CLK / Prescaler / ( COMP1+1 + COMP2+1)

The eTimer channel's Prescaler value depends on setting CTRL[PRISRC].

BR, Petr