PWM Configuration for Motorcontrol on S12XF512

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

PWM Configuration for Motorcontrol on S12XF512

1,213 Views
jedi82
Contributor I

Dear Forum,

 

I am trying to configure my PWM for a motor control use-case.

I have a lauterbach debugger and thus i can apply change to registers online.

I tried lots of different options (see screeshot), but somehow the PWM stopps working as soon as I change from independend outputs to complementary pairing.

 

So far I set up all interfaces with processor experts PWM-bean. The motor runs perfectly, but I the PWM-channels cannot be synchronized with CW-Standard-Edition unfortunatelly.

 

Can someone give me a hint?

thanks!

Labels (1)
0 Kudos
Reply
2 Replies

590 Views
jedi82
Contributor I

okay, i solved to problem - partly.

now i can configure the pwm as being center alligned and coming from one clock source with the standard PWM-Bean.

 

what*s to do?

 

in cpu.c:

set  PMFCFG0 =0x7 (outputs independent, setting complementairy outputs does not work for me at the moment - maybe someone can help)

correct the pwm-period as PE miscalculates the frequency nearly by factor 2. (I am running PLL at 50MHz)

 

in the PWM-Channel-Bean.c files (for me pwm1.c pwm2.c and so on):

for channels 2-5: manipulate the code so that LDOKA is used entirely.

 

see a screenshot of my settings above.

- this pwm is configured as

- 6 independend channels being clocked by one source

- 18000kHz at 50MHz PLL

 

working good!

 

 

0 Kudos
Reply

590 Views
ProcessorExpert
Senior Contributor III

Hello,

 

did you consider using PWMMC component that is intended to purpose that you exactly need (for more details please find attached screenshot)? But please note that this component is component from category called "Advanced Beans", therefore you need to have purchased "Profesional Suite" to use it or there should be possibility to buy this component separately in "Component store".
  
Regarding to incorrect timing in PWM bean  - I think this behavior is correct, because you are using center alignment mode, but PWM component supports edge alignment mode.
  
I think you should write 0x00 into PWMCFG0 to achieve single time base, center align mode, and complementary mode.

best regards
Vojtech Filip
Processor Expert Support Team
0 Kudos
Reply