How to calculate CTU compare register value(MPC5744xp)

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

How to calculate CTU compare register value(MPC5744xp)

ソリューションへジャンプ
1,133件の閲覧回数
xiemeijuan
Contributor II

My work target:

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

pastedImage_9.png

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?

pastedImage_10.png

Method2: Set PWM0_B2 VAL4 output trigger to CTU 

pastedImage_11.png

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.

1 解決策
974件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Set the same prescaler for both the PWM and CTU’s TGS counters. TGS counter starts from TGSCRR up to TGSCCR and is reloaded at MRS. So you can set TGSCRR=0 and TGSCCR equal to PWM period. Then is VAL0 is used for MRS generation, and T0CR = 0 you should get T0 trigger generation at the time of VAL0 compare.

BR, Petr

元の投稿で解決策を見る

1 返信
975件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Set the same prescaler for both the PWM and CTU’s TGS counters. TGS counter starts from TGSCRR up to TGSCCR and is reloaded at MRS. So you can set TGSCRR=0 and TGSCCR equal to PWM period. Then is VAL0 is used for MRS generation, and T0CR = 0 you should get T0 trigger generation at the time of VAL0 compare.

BR, Petr