I'm trying to generate a PWM signal using FTM0, chan 0 on the Vybrid VF6. I'm basing it on App Note AN5142, section 3.1. The issue is I don't get any output. Here is the setup I'm using:
ftm->FMS = 0x00; //clear WPEN (MOD_WPDIS will be set)
ftm->MODE |= 0x05;
ftm->SC = 0;
ftm->CONTROLS.CnSC = 0x28;
ftm->CONTROLS.CnV = 1000;
// The output of FTM0, chan 0 is on PTB0.
IOMUXC_RGPIO(22) = GPIO_OUT | IOMUX_DRIV_37 | IOMUX_ALT_FUNC_1;
ftm->CNTIN = 0;
ftm->SC = 0x0F;
I can see the counter counting (CNTIN changes), and appears to stay within the range 0 - 2000. The output on RPGIO(22) should change when CNTIN reaches 1000, but instead always stays low. One thing I noticed is that, even though I write 1000 to CONTROLS.CnV (C0V), it always shows 0x0 when looking at it with my debugger. I would assume it would read back 1000. Any ideas?