How can we configure TIMER (TPM3_CH2) inside the i.mx93 (mcimx93-evk) Input capture example?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can we configure TIMER (TPM3_CH2) inside the i.mx93 (mcimx93-evk) Input capture example?

118 Views
Manjunathb
Contributor I

 

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:

  • Connected a test signal (button) between J1005-3 (GPIO_IO12) and J1005-7 (GND)

  • Verified 3.3V logic and falling edge transition is present when pressing the button

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:

  • TPM Module: TPM3

  • Channel: CH2

  • Pin Used: GPIO_IO12 (confirmed to be J1005-3)

  • Edge: Falling edge

  • Board: MCIMX93-EVK

  • Clock: Default system clock settings


Questions:

  1. Is GPIO_IO12 correctly mapped to TPM3_CH2 in the EVK?

  2. Do I need any additional IOMUXC or pinmux configuration to enable TPM3_CH2 capture?

  3. Is IOMUXC_SetPinMux() or IOMUXC_SetPinConfig() required explicitly for GPIO_IO12?

  4. 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 

Labels (3)
0 Kudos
Reply
1 Reply

46 Views
pengyong_zhang
NXP Employee
NXP Employee

Hi @Manjunathb 

You need to configurate it in the dts file 

MX93_PAD_GPIO_IO12__TPM3_CH2
 
B.R
0 Kudos
Reply