How to initialize the module eTimer in MPC5604P

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

How to initialize the module eTimer in MPC5604P

903件の閲覧回数
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 返答(返信)

760件の閲覧回数
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

760件の閲覧回数
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 件の賞賛
返信

760件の閲覧回数
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