What is PWM range when using eTPU function? (MPC5644A)

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

What is PWM range when using eTPU function? (MPC5644A)

1,932件の閲覧回数
JinwooLim
Contributor I

Hi, i am trying to generate PWM signal using eTPU function.  (MPC5644A)

the function i am currently uing is   fs_etpu_pwm_update()

based on local parameter in this funciton, when the value of (chan_period*duty)/10000 gets over 426000 the generated PWM signal doesnt show up properly. 

the estimated problem is data overflow when trying write parameter value to data memory. 

how can i solve this problem?? and how can i generate full range pwm signal?? 

ps. i was trying to generate 250Hz, 80% duty but it didnt worked. and i realized memory overflow is happening somewhere between 250Hz 71~72% duty. which is 426000~432000 in ((chan_period*duty)/10000) value. 

0 件の賞賛
返信
6 返答(返信)

1,893件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Could you clarify which specific eTPU function is your question related to? Thanks

0 件の賞賛
返信

1,885件の閲覧回数
JinwooLim
Contributor I

hi

the name of funtion is "fs_etpu_pwm_update(channel, frequency, duty, timebase frequency)"

this function is in "etpu_pwm.c" file which is written by Jeff Loeliger, Revision is 2.0 

thanks

0 件の賞賛
返信

1,872件の閲覧回数
KarlP
Contributor II

I might be wrong but it looks like you have the etpu tcr1 or tcr2 set with a high frequency clock so generating a low frequency signal (250Hz) from that clock with a 24-bit count limit is causing a problem. 

Try adjusting the prescaler for the TCR used to lower the timebase frequency, e.g. down to 4MHz.  Set the fs_etpu_pwm_init to that new frequency as well as in fs_etpu_pwm_update.

0 件の賞賛
返信

1,869件の閲覧回数
KarlP
Contributor II

p.s.  if I work your numbers backward it appears that you have the timebase_freq set to 150MHz (system clock).  This is causing the overlfow within the fs_etpu_pwm_update function. 

The timebase_freq should be the TCR1 or TCR2 clock frequency, and that will need to be prescaled down to something more suitable so the 24-bit TCR counter works with your output frequency/resolution needs.

0 件の賞賛
返信

1,851件の閲覧回数
JinwooLim
Contributor I

Hi. First of all Thanks for the precise reply. 

basically i have only used fs_etpu_pwm_update() function without fs_etpu_pwm_init() funciton. 

would that mean if i do not use fs_etpu_pwm_init() function, etpu pwm is initialized automatically with TCR1 150MHz time base frequency? 

And the "Prescale down" you mentioned, can be done by modifying function timebase frequency input from TCR1 to TCR2?

 

0 件の賞賛
返信

1,845件の閲覧回数
JinwooLim
Contributor I

i have tried changing timebase freqeuncy from etpu_a_tcr1_freq(150MHz) to etpu_a_tcr2_freq(18750000) as input of fs_etpu_pwm_init(), fs_etpu_pwm_update() functions.

but the pwm signal doesnt show up.. 

should i change eTPU timebase frequency register settings somewhere?? 

0 件の賞賛
返信