AnsweredAssumed Answered

How to calculate CTU compare register value(MPC5744xp)

Question asked by xiemeijuan on Feb 21, 2018
Latest reply on Feb 27, 2018 by Petr Stancik

My work target:

At the middle point of FlexPWM0_B2  to trigger CTU to trigger the ADC commands.

Motc_Clk:

160Mhz

PWM setting: 

Centered aligned 

prescaler:PRESC_1

CTU setting:

prescaler:PRESC_4

 

Method1:  Set PWM0_B2 VAL0 output trigger to CTU 

Issues:      I found CTU trigger is not in the middle of FlexPWM0_B2 (No CTU TCR0V=0)

Question:  Why VAL0 output trigger is not in the middle of FlexPWM?

 

Method2: Set PWM0_B2 VAL4 output trigger to CTU 

 

 

Issues:

When I set VAL4 output trigger to CTU, I found the TCR0V needed to be varied with PWM period and dutycyle.

Question:

So how to set TCR0V according to PWM prescaler,PWM period and dutycyle and CTU prescaler? For example,PWM frequency 20Khz,50% duty cyle.

Outcomes