Force PWM to SW demand (DTSRCSEL and Force_out) - how to make the PWM take over my user value SWCOUT

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

Force PWM to SW demand (DTSRCSEL and Force_out) - how to make the PWM take over my user value SWCOUT

773 Views
_ThomasLorenz_
Contributor II

Hi

I want to use the force feature to add an IGBT bootstrapping sequence to the PWM.

Normal PWM is working OK. Bootstrapping up to now was done with faulttest and faultlevel but then there is no  fault protection -> I would like to use the force feature.

I have see this post where the attached picture comes from - but I wonder how I make the PWM take over my SW demand. Do I need a special order of the commands (switch source, set sw level, set force level trigger force) , does the force bit need a rising edge or can I just wirte new to it....

 

If have added this code - but it seems the SWCOUT pwm demand output is not switched properly (is visible on the pwm output).

 

void syshal_pwm1_set_low_disable_up_boot(pwm_submodule_t subModule, uint16_t low_IGBT_val)
{

PWM1->FTST = 0;

// out enable
PWM1->OUTEN |= ((0x111U)<<subModule);

//Force flag .FORCE = 0, FORCE_SEL = 0 (local mode),
PWM1->SM[subModule].CTRL2&=~(PWM_CTRL2_FORCE_MASK + PWM_CTRL2_FORCE_SEL_MASK);

//Force_sel is set to local force
//FRCEN is off

const uint16_t up_IGBT_val=0;

PWM1->SWCOUT= (PWM1->SWCOUT
&
(~((PWM_SWCOUT_SM0OUT45_MASK+PWM_SWCOUT_SM0OUT23_MASK)<<(subModule*2)))
)
+
(
(
(( low_IGBT_val & PWM_SWCOUT_SM0OUT45_MASK)<<PWM_SWCOUT_SM0OUT45_SHIFT)
+
((up_IGBT_val & PWM_SWCOUT_SM0OUT45_MASK)<<PWM_SWCOUT_SM0OUT23_SHIFT)
)
<<(subModule*2)
);

//enable force (trigger or static or rewrite?)
PWM1->SM[subModule].CTRL2|=PWM_CTRL2_FORCE_MASK;

PWM1->DTSRCSEL= (PWM1->DTSRCSEL
&
(~((PWM_DTSRCSEL_SM0SEL45_MASK+PWM_DTSRCSEL_SM0SEL23_MASK)<<(subModule*4)))
)
+
(
(
((kPWM_SoftwareControl&PWM_DTSRCSEL_SM0SEL45_MASK)<<PWM_DTSRCSEL_SM0SEL45_SHIFT)
+
((kPWM_SoftwareControl&PWM_DTSRCSEL_SM0SEL45_MASK)<<PWM_DTSRCSEL_SM0SEL23_SHIFT)
)

//kPWM_SoftwareControl is 2


<<(subModule*4)
);

/*! SM0SEL45/23 - Submodule 0 PWM45 Control Select
* 0b00..Generated SM0PWM45 signal is used by the deadtime logic.
* 0b01..Inverted generated SM0PWM45 signal is used by the deadtime logic.
* 0b10..SWCOUT[SM0OUT45] is used by the deadtime logic.
* 0b11..PWM0_EXTB signal is used by the deadtime logic.
*/

//enable force (trigger or static or rewrite?)
PWM1->SM[subModule].CTRL2|=PWM_CTRL2_FORCE_MASK;

}

 

 

  

Labels (2)
Tags (2)
0 Kudos
1 Reply

730 Views
_Leo_
NXP TechSupport
NXP TechSupport

Thank you so much for your interest in our products and for using our community.

The FORCE_OUT signal is explained with a little bit more detail in section 72.3.2.6 Force Out Logic of the Reference Manual. Also provides the example of this feature for a BLDC motor to illustrate its usage in section 72.3.1.7 Synchronous Switching of Multiple Outputs.

Hope it helps you. Please let me know if you have more questions about it.

Have a nice day!

0 Kudos