AnsweredAssumed Answered

ftm

Question asked by Ken Green Green on Jun 26, 2018
Latest reply on Jun 27, 2018 by Ken Green Green

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 = FTM0_BASE;
   ftm->CONF = 0xC0;   //set BDM to 11
   ftm->FMS = 0x00;    //clear WPEN (MOD_WPDIS will be set)
   ftm->MODE |= 0x05;
     
   ftm->SC = 0;
   ftm->MOD = 2000;
   ftm->CONTROLS[0].CnSC = 0x28;
   ftm->CONTROLS[0].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[0].CnV (C0V), it always shows 0x0 when looking at it with my debugger. I would assume it would read back 1000. Any ideas?

Outcomes