How to properly change input capture configuration from TPM2_CH0 to TPM3_CH2 in i.MX93 SDK example?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to properly change input capture configuration from TPM2_CH0 to TPM3_CH2 in i.MX93 SDK example?

362 次查看
Manjunathb
Contributor II

Hello NXP Community,

I'm working on the input capture demo example from the MCUXpresso SDK for i.MX93. By default, the example uses TPM2 Channel 0 (TPM2_CH0) for input capture. I would like to switch this to use TPM3 Channel 2 (TPM3_CH2) instead.

Could you please clarify what all changes need to be made in the SDK code and configuration files to successfully switch the input capture source from TPM2_CH0 to TPM3_CH2?

Here’s what I’ve identified so far:

  1. Update DEMO_TPM_BASEADDR from TPM2 to TPM3.

  2. Update BOARD_TPM_INPUT_CAPTURE_CHANNEL from kTPM_Chnl_0 to kTPM_Chnl_2.

  3. Change the IRQ handler from TPM2_IRQHandler to TPM3_IRQHandler.

  4. Update TPM_INTERRUPT_NUMBER accordingly.

  5. Pin Muxing: I believe the pin for TPM3_CH2 needs to be correctly muxed via IOMUXC. What pin should I use on the i.MX93 EVK or custom board for TPM3_CH2 input?

Are there any additional steps, especially related to:

  • Clock source setup for TPM3?

  • Enabling TPM3 module in RDC or CCM?

  • Input signal routing (XBAR or SAI to TPM)?

  • Anything specific to i.MX93 SoC or SDK behavior?

Any guidance, especially with respect to clock trees and signal routing for TPM3_CH2, would be highly appreciated.

Thank you!

i.MX93EVK 

标签 (1)
0 项奖励
回复
2 回复数

342 次查看
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @Manjunathb 

 

I hope you are doing very well.

 

I am not sure what SDK version are you using. I tested with the SDK_25_03_00_MCIMX93-EVK.

 

The changes are:

app.h

/*
 * Copyright 2022 NXP
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
#ifndef _APP_H_
#define _APP_H_

/*******************************************************************************
 * Definitions
 ******************************************************************************/
/*${macro:start}*/
/* define instance */
#define DEMO_TPM_BASEADDR TPM3

/* Interrupt to enable and flag to read; depends on the TPM channel used */
#define BOARD_TPM_INPUT_CAPTURE_CHANNEL kTPM_Chnl_2

/* Interrupt to enable and flag to read; depends on the TPM channel used */
#define TPM_CHANNEL_INTERRUPT_ENABLE kTPM_Chnl2InterruptEnable
#define TPM_CHANNEL_FLAG             kTPM_Chnl2Flag

/* Interrupt number and interrupt handler for the TPM instance used */
#define TPM_INTERRUPT_NUMBER      TPM3_IRQn
#define TPM_INPUT_CAPTURE_HANDLER TPM3_IRQHandler

/* Get source clock for TPM driver */
#define LPTPM_CLOCK_ROOT kCLOCK_Root_Tpm3
#define LPTPM_CLOCK_GATE kCLOCK_Tpm3
#define TPM_SOURCE_CLOCK CLOCK_GetIpFreq(LPTPM_CLOCK_ROOT)
/*${macro:end}*/


//#define WAKEUP kCLOCK_Root_BusWakeup

/*******************************************************************************
 * Prototypes
 ******************************************************************************/
/*${prototype:start}*/
void BOARD_InitHardware(void);
/*${prototype:end}*/

#endif /* _APP_H_ */

 

pin_mux.c

void BOARD_InitPins(void) {                                /*!< Function assigned for the core: undefined[cm33] */
    IOMUXC_SetPinMux(IOMUXC_PAD_GPIO_IO12__TPM3_CH2, 0U);
    IOMUXC_SetPinMux(IOMUXC_PAD_UART2_RXD__LPUART2_RX, 0U);
    IOMUXC_SetPinMux(IOMUXC_PAD_UART2_TXD__LPUART2_TX, 0U);

    IOMUXC_SetPinConfig(IOMUXC_PAD_GPIO_IO12__TPM3_CH2, 
                        IOMUXC_PAD_DSE(15U));
    IOMUXC_SetPinConfig(IOMUXC_PAD_UART2_RXD__LPUART2_RX, 
                        IOMUXC_PAD_PD_MASK);
    IOMUXC_SetPinConfig(IOMUXC_PAD_UART2_TXD__LPUART2_TX, 
                        IOMUXC_PAD_DSE(15U));
}

 

 

According to the reference manual, the Pad that you must set to use as TPM3_CH2 is GPIO_IO12:

Manuel_Salas_0-1752515169161.png

That pad is exposed in the J1001 in EVK:

Manuel_Salas_1-1752515241066.png

 

Best regards,

Salas.

 

0 项奖励
回复

338 次查看
Manjunathb
Contributor II
@Manuel_Salas
Thank you for your response