Hi all,
I'm trying to configure FTM interrupt on the MK64FN1M0xxx12 device using the SDK_2.x_FRDM-K64F API.
I started importing and testing from the SDK the example frdmk64_ftm_output_compare, which works as expected.
I then updated the code adding the following functions to the main file (ftm_output_compare.c):
void FTM0_IRQHandler(void){
uint32_t flags = FTM_GetStatusFlags(BOARD_FTM_BASEADDR);
FTM_ClearStatusFlags(BOARD_FTM_BASEADDR, flags);
}
/*!
* @brief Main function
*/
int main(void)
{
...
...
/* Set the timer to be in free-running mode */
BOARD_FTM_BASEADDR->MOD = 0xFFFF;
/* enable interrupt */
FTM_EnableInterrupts(BOARD_FTM_BASEADDR, kFTM_Chnl0InterruptEnable);
/* Update the buffered registers */
FTM_SetSoftwareTrigger(BOARD_FTM_BASEADDR, true);
FTM_StartTimer(BOARD_FTM_BASEADDR, kFTM_SystemClock);
while (1)
{
};
}I think that this should be enough to trigger the interrupt, but obviously it doesn't since that doesn't work.
Looking to the available peripheral API, I can't find other eventual functions necessary to be called, to enable the desired behavior that is: fire an interrupt every time the timer counter matches the channel value.
I really look forward to read some answers.
Kind regards,
AGA