HI,
I'm new in programming KL25Z, and I'm trying to understand how I can handle an interrupt in input-capture mode of TPM. I got build-in handles for a lot of ports and timers such as PORT A/D, timer PIT and I don't know who created them or how (I'm working on code that was given to me by university). unfortunately, there is not any handler for any TPM.
without having an handler for it, it seems to me useless to use input-capture mode.
I'm adding the startup code with all the handlers I got.
I will appreciate a solution for that,
Solved! Go to Solution.
Hi, Ofir
From hardware perspective, you have to connect the external signal to TPM_CHx pin, all the TPM function share the same interrupt vector, so you have to check the interrupt source in the FTM0_IRQHandler(), which is the ISR of the FTM capture interrupt.
From software perspective, all TPM pins are multiplexed with the GPIO pins, this is the process:
1)enable PORT clock in the SIM_SCGC5
2)set the MUX bits of PORTx_PCRy so that the pin function as TPM.
3)configure the TPM module
4)enable interrupt for example
I attach an example for capture function based on KE02, pls refer to it.
Hope it can help you
BR
Xiangjun Rong
Hi, Ofir
From hardware perspective, you have to connect the external signal to TPM_CHx pin, all the TPM function share the same interrupt vector, so you have to check the interrupt source in the FTM0_IRQHandler(), which is the ISR of the FTM capture interrupt.
From software perspective, all TPM pins are multiplexed with the GPIO pins, this is the process:
1)enable PORT clock in the SIM_SCGC5
2)set the MUX bits of PORTx_PCRy so that the pin function as TPM.
3)configure the TPM module
4)enable interrupt for example
I attach an example for capture function based on KE02, pls refer to it.
Hope it can help you
BR
Xiangjun Rong