PWM Synchronization

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM Synchronization

254 Views
aash92
Contributor I

I'm using S32144 48lqfp mcu on my mode and  used pwm synchronization in hardware trigger mode, and i'm using two hardware trigger 0 and hardware trigger 1

as outmask and swoctrl is updating in main code as well as in for loop but not updating input capture mode call back??.

 Below i attached my code .

ic call back :

void HallSensorDetection()

{

FTM1->CNT = 0;
ACTUATE_SetPwmMask(0X34, 0X0808, HW_INPUT_TRIG0);
PINS_DRV_TogglePins(PTB,(uint32_t) (1 << 5));

}

tBool ACTUATE_SetPwmMask(uint8_t ui8OutMask, uint16_t ui16SwCtrl, tBool ftmInputTrig)
{
/* Clear FTM3SYNCBIT to prepare HW trigger for FTM3 */
SIM->FTMOPT1 &= ~(SIM_FTMOPT1_FTM3SYNCBIT_MASK & (ftmInputTrig << SIM_FTMOPT1_FTM3SYNCBIT_SHIFT));

// Apply Mask
//FTM3->OUTMASK = ui8OutMask;
FTM_DRV_MaskOutputChannels(INST_FLEXTIMER_PWM3, ui8OutMask, false);
FTM3->SWOCTRL = ui16SwCtrl;

/* Set FTM3SYNCBIT to trigger and update FTM3 registers */
SIM->FTMOPT1 |= (SIM_FTMOPT1_FTM3SYNCBIT_MASK & (ftmInputTrig << SIM_FTMOPT1_FTM3SYNCBIT_SHIFT));

return 1;
}

Labels (2)
0 Kudos
1 Reply

151 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi aash92,

Could you halt the application at this line:

SIM->FTMOPT1 |= (SIM_FTMOPT1_FTM3SYNCBIT_MASK & (ftmInputTrig << SIM_FTMOPT1_FTM3SYNCBIT_SHIFT));

And read the FTM3_SYNC[TRIG1] bit with the debugger to see if the trigger is enabled?

Thanks,

BR, Daniel

0 Kudos