Hello NXP Team,
I am working with the MCIMX93-EVK and trying to run the TPM input capture example using TPM3_CH2, which is mapped to GPIO_IO12 on the board.
I followed the hardware guidelines:
However, the code never enters the TPM3_IRQHandler, and the capture value is not being printed in the terminal.
Here is my modified code:
#include "fsl_debug_console.h"
#include "board.h"
#include "app.h"
#include "fsl_tpm.h"
#include "fsl_rgpio.h"
volatile bool tpmIsrFlag = false;
void TPM3_IRQHandler(void)
{
tpmIsrFlag = true;
TPM_ClearStatusFlags(TPM3, kTPM_Chnl2Flag);
SDK_ISR_EXIT_BARRIER;
}
int main(void)
{
tpm_config_t tpmInfo;
BOARD_InitHardware();
PRINTF("\r\nTPM input capture example\r\n");
PRINTF("\r\nOnce the input signal is received the input capture value is printed\r\n");
TPM_GetDefaultConfig(&tpmInfo);
TPM_Init(TPM3, &tpmInfo);
// Configure TPM3_CH2 input capture (falling edge)
TPM_SetupInputCapture(TPM3, kTPM_Chnl_2, kTPM_FallingEdge);
TPM_SetTimerPeriod(TPM3, 0xFFFFFFFFU);
TPM_EnableInterrupts(TPM3, kTPM_Chnl2InterruptEnable);
EnableIRQ(TPM3_IRQn);
TPM_StartTimer(TPM3, kTPM_SystemClock);
while (!tpmIsrFlag) { }
PRINTF("\r\nCapture value C(n)V=%x\r\n", TPM_GetChannelValue(TPM3, kTPM_Chnl_2));
while (1) { }
}
My Setup:
Questions:
Is GPIO_IO12 correctly mapped to TPM3_CH2 in the EVK?
Do I need any additional IOMUXC or pinmux configuration to enable TPM3_CH2 capture?
Is IOMUXC_SetPinMux() or IOMUXC_SetPinConfig() required explicitly for GPIO_IO12?
Can you confirm if TPM3_CH2 is routed and enabled by default on MCIMX93-EVK?
Any insight or working examples using TPM3_CH2 would be greatly appreciated.
Thank you!
i.MX93 SPIFI-NXP-MICROCONTROLLERS TPMS-SW IMX93QSB