AnsweredAssumed Answered

PWM Synchronization

Question asked by aash Mohd on Apr 1, 2020
Latest reply on Apr 6, 2020 by Daniel Martynek

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;
}

Attachments

Outcomes