cancel
Showing results for 
Search instead for 
Did you mean: 

how to configure flex pwm to give complementary pwm of 20 khz.

kjay
Associate II

.i need help with calculating clock and time peroid and waht is other pwm pin if pwm0 has d10 which is complemetary pin in spc56el70l5-disp

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
82 REPLIES 82
zambrano.luigi
Senior III

Hi,

if you open the Pin Map Wizard (graphic pin editor, please, see picture in attachment) to edit the pins, you cannot use the standard edit view till you don't close the Pin Map Wizard. In other words, there is only one active edit view at a time, the standard view or the Pin Map Wizard.

Best Regards,

Luigi

THANKS I NEED TO CLARIFY another thing to activate complementary on pwm A0 and B0 we use

 pwm_lld_start(&PWMD1, &pwm_config_pwmcfg);

and

pwm_lld_enable_channel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1,5000));

and to activate same frquency complemetary on A1 and B1 what should i update on the coding....

pwm_lld_enable_channel(&PWMD1, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD1,5000));

adding above line is enough or not............cause it has pwmd1 and channel 1...if i add this it is not working

zambrano.luigi
Senior III

Hi,

if the option Synchronized FlexPWM1 is disabled, each PWM driver manages a FlexPWM submodule with 2 channels (A and B). So, A0 and B0 are the channel 0 and channel 1 of the PWMD1, while A1 and B1 are the channel 0 and the channel 1 of the PWMD2. So, A0 and B0 are activated by the following instructions

pwm_lld_enable_channel(&PWMD1, 0, ...

pwm_lld_enable_channel(&PWMD1, 1, ...

while A1 and B1 are activated by following instructions

pwm_lld_enable_channel(&PWMD2, 0, ...

pwm_lld_enable_channel(&PWMD2, 1, ...

Otherwise, if the option Synchronized FlexPWM1 is enabled, or the 4 submodules of the FlexPWM0 are synchronized. In this case the whole FlexPWM0 is managed by a unique driver (PWMD1) with 8 channels (A0 = 0, B0 = 1, A1 = 2, B1 = 3, A2 = 4, B2 = 5, A3 = 6 and B3 = 7). So, A0 and B0 are activated by the following instructions:

pwm_lld_enable_channel(&PWMD1, 0, ...

pwm_lld_enable_channel(&PWMD1, 1, ...

while A1 and B1 are activated by following instructions

pwm_lld_enable_channel(&PWMD1, 2, ...

pwm_lld_enable_channel(&PWMD1, 3, ...

Best Regards,

Luigi

thanks for the answer ...i have issue...ii have to use 2 chip select pins for DSPI0...i havegot result using single chipselect...how can i use another cs...i have to switch between cs0 and cs1 for 2 sensor inside the program..can you give me an example..

it works as you said in sync disabled mode...i update channel 1 on pwmd1 and pwmd2 ..it implements complementary on channel 0 on pwmd0 and pwmd1.

but in sync enabled ..i tried as u said i try to enable pwmd1 and channel 3 which is b1 no output on d10 and d11(x6 connector) what am i missing i checked configurations too...it seems legit.i attach my code please check..

zambrano.luigi
Senior III

Hi,

if you enable the synchronization, you have also to update the PWM cofiguration (pwmcfg), enabling within the configuration all the needed channels. In particular, when the synchronization is enable, the PWM driver configuration allows to enable 8 channels and not only 2.

Best Regards,

Luigi

could you please elaborate and give me example..please answer my dspi question..

kjay
Associate II

i have issue...ii have to use 2 chip select pins for DSPI0...i havegot result using single chipselect...how can i use another cs...i have to switch between cs0 and cs1 for 2 sensor inside the program..can you give me an example..

zambrano.luigi
Senior III

Hi,

sorry for the delay. Your usage case is the typical case with one master and two slaves. In order to manage it:

  1. in the board component configure 2 chip selects for the master (for example, CS0 and CS1) and connect CS0 with the CS of the first slave and CS1 to the CS of the second slave
  2. in the DSPI settings define 2 different configurations, one with PCS Line to PCS0 and another with PCS Line to PCS1. Then, if the first configuration is loaded (with the function spi_lld_start), the master will be able to communicate only with the first slave. If the second configuration is loaded, the master will be able to communicate only with the second slave. If you want to switch between the first and the second slave, you have to unload the previous configuration (with the function spi_lld_stop) and load the new one (with the function spi_lld_start).

Best regards,

Luigi

kjay
Associate II

is there any plug in or extension that i can use for MISRA C standrad checking in SPC5studio...if answer is no ..can you suggest how to check my code compatibility with MISRA C standard which is originally written in SPC5 studio from your experience..\thank you..