I've been trying to configure the FTM0 Flex Timer to generate centered aligned PWM. I have followed several examples I've found on the internet even on here on the forum however, I cannot get channel 0 (PORTC PTC1) to output the pulse wave. I have double, triple and quadruple checked all the register configurations and they seem correct. I've pasted my code below:
SIM_BASE_PTR->SCGC5 |= SIM_SCGC5_PORTC_MASK;
SIM_BASE_PTR->SCGC6 |= SIM_SCGC6_FTM0_MASK;
PORTC_BASE_PTR->PCR[1] = PORT_PCR_MUX(4) | PORT_PCR_DSE_MASK;
temp = FTM0_BASE_PTR->FMS;
FTM0_BASE_PTR->MODE |= FTM_MODE_WPDIS_MASK;
FTM0_BASE_PTR->MODE &= ~FTM_MODE_FTMEN_MASK;
FTM0_BASE_PTR->QDCTRL &= ~FTM_QDCTRL_QUADEN_MASK;
FTM0_BASE_PTR->CNT = 0;
FTM0_BASE_PTR->MOD = 4000;
FTM0_BASE_PTR->CNTIN = 0;
FTM0_C0SC = FTM_CnSC_ELSA_MASK;
FTM0_C0V = 2000;
FTM0_BASE_PTR->SC = FTM_SC_CPWMS_MASK | FTM_SC_CLKS(1);
What am I missing that is preventing the PWM signal from coming out on PWM0?