How to initialize the module eTimer in MPC5604P

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

How to initialize the module eTimer in MPC5604P

798 Views
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

Labels (1)
3 Replies

655 Views
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

655 Views
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 Kudos
Reply

655 Views
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