Hi,
I'm a beginner when dealing with the s32k144 so please be patient with me.
I would like to use timer FTM0 channel 0 as a PWM source and update its CnV (compare register ) according to some events. the pwm works when initialized however it is not updated when I run the following command.
FTM0-> CONTROLS [0] = .CnV FTM_CnV_VAL (new_pwm_value);
PCC-> PCCn [PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK;
PCC-> PCCn [PCC_FTM0_INDEX] = PCC_PCCn_PCS (6) | PCC_PCCn_CGC_MASK;
PORTD-> PCR [15] = PORT_PCR_MUX (2);
FTM0-> MODE = FTM_MODE_FTMEN_MASK;
FTM0-> MOD = FTM_MOD_MOD (8000-1);
FTM0-> CNTIN = FTM_CNTIN_INIT (0);
FTM0-> CONTROLS [0] .CnSC = FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK;
FTM0-> CONTROLS [0] = .CnV FTM_CnV_VAL (7000);
FTM0-> CNT = 0;
FTM0-> SC = FTM_SC_CLKS (1) | FTM_SC_PS ( 0 ) | FTM_SC_PWMEN0_MASK ;
Please advise.
Hi,
This has been already discussed here on the community.
Please take a look at this thread:
https://community.nxp.com/message/1012624
Thank you,
BR, Daniel