MCUXpresso PWM simultaneously Update DutyCycle

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

MCUXpresso PWM simultaneously Update DutyCycle

Jump to solution
1,704 Views
jasomalencar
Contributor I

I am using the board FRDM-K22F with the example to use the pwm multiple pwm channels. I've been included one more channel, and it is working very well.

My question is:

Is possible to shutdown or puty duty cycle to 0 in two channels simultaneously?

To Update the Duty Cycle I am using de default function from the SDK.

FTM_UpdatePwmDutycycle(BOARD_FTM_BASEADDR, (ftm_chnl_t)BOARD_FIRST_FTM_CHANNEL, kFTM_EdgeAlignedPwm, updatedDutycycle);
FTM_UpdatePwmDutycycle(BOARD_FTM_BASEADDR, (ftm_chnl_t)BOARD_SECOND_FTM_CHANNEL, kFTM_EdgeAlignedPwm, updatedDutycycle);
FTM_UpdatePwmDutycycle(BOARD_FTM_BASEADDR, (ftm_chnl_t)BOARD_THIRTH_FTM_CHANNEL, kFTM_EdgeAlignedPwm, updatedDutycycle);

I should to control the PWM channels to a 3-phase bridge, then, just one channel must be in high level.

PWM Channel

A B C

0 0 1

0 1 0

1 0 0

Thanks,

Jasom

Tags (2)
1 Solution
1,344 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Jasom,

I see that you control a BLDC, okay. As you know that you have to use masking function of FTM to disable one BLDC phase, use invertering function of FTM to inverter one pair PWM signals. Both masking and invertering function of FTM can be implemented with the software triggering. In detail, based on the rotor position, you can implement with the code like this:

FTMx_INVCTRL=0xxxxx;

FTMx_OUTMASK=0xxxxx;

FTM0_SYNC|=FTM_SYNC_SWSYNC_MASK;

You can refer to the an5142.

https://www.nxp.com/docs/en/application-note/AN5142.pdf?fsrch=1&sr=1&pageNum=1 

Hope it can help you

BR

Xiangjun Rong

View solution in original post

3 Replies
1,344 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Jasom,

As you know that there is only ONE FTM counter, which can generate 8 PWM channel signals, it means that all PWM signal are aligned no matter you use edge-alignment or center-alignment, the asymmetric PWM signal mode is an exception.

Do you control BLDC or PMSM/ACIM? If you control BLDC, the inverter for different phase(branch) is implemented with the FTM Inverting Control with the FTMx_INVCTRL register setting or FTM Software Output Control. If you control PMSM/ACIM, it is another story, we use SVPWM algorithms to control the vector, in the case, we do not use invertering function of FTM.

Do you control BLDC or PMSM/ACIM?

Hope it can help you

BR

Xiangjun rong

1,344 Views
jasomalencar
Contributor I

Thanks for your help Xiangjun rong,

I will control a BLDC Motor, so I think the FTM Inverting to be the best way.

I am new in arm development and I am trying to use the SDK functions, but I will study the registers to use this resource if isn't any SDK function. Do you have any tip to initialize and manipulate the FTM inverter by the registers?

0 Kudos
Reply
1,345 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Jasom,

I see that you control a BLDC, okay. As you know that you have to use masking function of FTM to disable one BLDC phase, use invertering function of FTM to inverter one pair PWM signals. Both masking and invertering function of FTM can be implemented with the software triggering. In detail, based on the rotor position, you can implement with the code like this:

FTMx_INVCTRL=0xxxxx;

FTMx_OUTMASK=0xxxxx;

FTM0_SYNC|=FTM_SYNC_SWSYNC_MASK;

You can refer to the an5142.

https://www.nxp.com/docs/en/application-note/AN5142.pdf?fsrch=1&sr=1&pageNum=1 

Hope it can help you

BR

Xiangjun Rong