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?

In looking around in the forum I found that Edward Karpicz (3/26/14) had the same issue. It takes multiple writes to the CnV register before the value actually gets written. The above code was running on the A5 processor; processor speed was 396 MHz. The clock going into FTM0 was 66 MHz, then divided by 128. I solved the problem by doing the following:

i = 20;

do

{

ftm->CONTROLS[0].CnV = value;

i--;

} while((ftm->CONTROLS[0].CnV != value) && (i > 0));

I haven't checked the value of i when the loop is exited, but CnV always has the new value.