FlexPWM Force event to update mask status?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FlexPWM Force event to update mask status?

1,017 次查看
duanemattern
Contributor III

I'm using a TRK-MPC5604P kit and I have PWM Modules 2 & 3 (A&B) running on Port G, for 4 independent center-aligned PWM signals.   I'm using FreeMaster to change a state variable to update some PWM values on the fly.

 

170832_170832.pngpastedImage_2.png

 

I'm trying to figure out a good/best way to turn channels on and off without affecting the other channels and also being synchronized.     I know I can set duty cycles to zero, but I'd rather not do that.  I currently have two options, but I want to know if there is a side affect using the Force logic.  Basically I'm trying to see how the MASK register works and to understand if  I should be using it for this purpose.

 

Method1:  change the mask, which appears to requires a force event to take affect

         FLEXPWM_0.MASK.R = 0x00C0;             //Turns off B ch in mod2.  Didn't turn off ch A, but don't know why?
         FLEXPWM_0.SUB[2].CTRL2.B.FORCE = 1;

 

Method2:  changed the enable for the individual channel.

         FLEXPWM_0.OUTEN.R = 0x0C00;       //0000-1100-0000-0000     leave on A, turns off both B ch in modules 2&3

 

The OUTEN method works fine and I can use that. I'm just wonder when MASK is used.

标签 (1)
标记 (3)
1 回复

857 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

The difference is the OUTEN makes the output tristated and it is done immediately when OUTEN bit is cleared.

The MASK register is buffered and FORCE_OUT event must occur to make it effective. In this case the output is still active with high or low level based on OCRTL[POLx] bit setting. FORCE_OUT can be generated immediately upon SW FORCE, you did, or based on several other HW signals (local reload/sysnc, master reload/sync, etc).

The advantage of MASKing is that it can be aligned with PWM period, so masking is done in defined time by hardware. This is commonly used in BLDC commutation.

BR, Petr