working with pwm channels - mc9s08sh32

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

working with pwm channels - mc9s08sh32

926 Views
shany
Contributor II

Hello,

I'm working on MCU - mc9s08sh32 and I want to operate 3 pwm channels - PTA6_TPM2CH0, PTB5_TPM1CH1, PTA7_TPM2CH1.

My problem is with the first and last channels ( PTA6 + PTA7 ) - they have a shared counter (TPM2) and I don't really know how to control their pwm ratio. When I enable both of them - each with different pwm ratios - one of them is off and sometimes there is some pwm ratio but I don't know how to predict it.

Does anybody have an idea what to do?

Does anybody have a sample project with these pwm channels?

Thanks,

shany

 

Labels (1)
Tags (1)
0 Kudos
3 Replies

690 Views
ProcessorExpert
Senior Contributor III

Hello,

 

I am not aware of such issue with PWM component. However could you please share here your project including more detailed description.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos

690 Views
shany
Contributor II

Hello,

Here's a more detailed description of my problem -

When I try to activate all 3 pwm channels on 100% ratio - the code is :

pwm1_SetRatio8(0);
pwm2_SetRatio8 (0);
pwm3_SetRatio8 (0); 
  
 pwm1_Enable();
 pwm2_Enable();
 pwm3_Enable();

 

however, the outcome is sometimes correct - meaning that all 3 pwm channels are on 100% ratio, and in other times the outcome is that only pwm1+2 are on 100% ratio while pwm3 is off completely  (pwm2 + 3 are the ones with the shared counter, as I mentioned in the previous message).

 

Another problem - when I perform  the following code -

pwm1_SetRatio8(255);
pwm2_SetRatio8 (25);
 pwm3_SetRatio8 (200); 
    
pwm1_Disable();

pwm2_Enable();
pwm3_Enable();

 

again, the outcome is sometimes correct and in other times pwm2 + pwm 3 are on 100% and not in the required pulse ratio.

 

I hope there are enough details here... please tell me if you need further information.

Thanks alot,

Shany    

0 Kudos

690 Views
ProcessorExpert
Senior Contributor III

Hello,

 

as I wrote before. Could you please post here your project? Please note that it will significantly reduce my time on your issue.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 Kudos