Hello,
I am using the FTM2 in Output Compare mode. This timers get the reference clock through external clock (100 KHz), so it overflows each 655.4ms. I am interested in using the Channel Match interrupt capabilities of this peripheral, but the content of FTM2_C0V is never updated. The reference manual said that this register is updated in the next count of FTM2 after FTM2_C0V was written (in my case, CLKS !=0 and FTMEN=0) but it always remains the same value. Check this simple code:
PE_ISR(FTM2_overflow)
{
FTM2_C0SC &= (uint32_t)~0x80UL; //Clear flag
sendUart(FTM2_C0V); //Print FTM2_C0V value
}
void setTimer(void)
{
FTM2_C0V=0x7FFF;
FTM2_C0SC &= (uint32_t)~0x80UL; //Clear flag to clean previous channel matches
FTM2_C0SC |= (uint32_t)0x40UL; // Channel match interrupt enabled
}
When setTimer function is called, UART send the FTM2_C0V value each 655.4 ms, but this value is always 0x0000 (the default value) instead 0x7FFF.
Thank you
Jose