TPM V3 initialisation

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

TPM V3 initialisation

1,533件の閲覧回数
Lj_cyril
Contributor I

Hi evrybody,

 

I use the TPM module version 3 on a 9S08AC60 in PWM edge aligned methode

and i have some trouble with the setup of this module.

 

Here is my code :

  //setup timer for PWM leds
  TPM1MOD=MAX_VALUE_PWM-2;
  TPM1SC=0x08;
 
  //setup timer PWM led by led  
  TPM1C0V=0;
  TPM1C2V=0;
  TPM1C3V=0;
 
  TPM1C0SC=0x24;
  TPM1C2SC=0x24;
  TPM1C3SC=0x24;

and after to change the duty cycle

        TPM1C0V=table_cpt_pwm[0];
        TPM1C2V=table_cpt_pwm[2];
        TPM1C3V=table_cpt_pwm[1];

 

 

My trouble is that when i reset  my CPU, i can see 1 duty cycle

at 0. and after all works fine.

 

Any idea ??

 

Thanks for your help

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

934件の閲覧回数
Harman
Contributor II

Please how did you solve the mentioned problem. I have the same one now. Thank you very much.

Jan

0 件の賞賛
返信

934件の閲覧回数
bigmac
Specialist III

Hello Jan,

 

As the TPM module provides buffered PWM operation, the observed behavior is correct - the duty cycle will not change until the next TPM overflow occurs.  If you need immediate update of a new channel register value, disable the TPM module before doing the update.

 

During TPM initialisation, you should consider that the TPM1SC register be the final one to be written, to enable the module.

 

Regards,

Mac

 

0 件の賞賛
返信