How to configure GPIO and Timer pins on MaaxBoard (NXP i.MX93) and enable pinmux settings ?

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

How to configure GPIO and Timer pins on MaaxBoard (NXP i.MX93) and enable pinmux settings ?

468 Views
Manjunathb
Contributor II

I am working with the MaaxBoard (based on the NXP i.MX93 processor), and I need help with configuring the pinmux and pin configuration for the following use case:

  • I need one GPIO pin as a trigger pin (output).

  • I need to configure one pin for a Timer input (TPM Input Capture or PWM).

The problem is:

  • The GPIO pin is not responding correctly to read/write operations.

  • I suspect the pinmux configuration is missing or incorrect, or the device tree is not updated properly.

Could you help me with the following?

  1. How to find the correct pin name and pad for GPIO and Timer in the MaaxBoard pinout and reference manual?

  2. What changes are needed in the Device Tree (.dts) to enable the required pinmuxing for:

    • Configuring the GPIO pin for output and allowing read/write from user space

    • Configuring the Timer pin for input capture or PWM

  3. Any common issues that can prevent GPIO from working correctly on MaaxBoard?

  4. Is their any example how to configure one gpio for read and write ? for that what and all we need to update like pin_mux.c and app.h ?

i.MX93 #maaxboard 

Labels (1)
0 Kudos
Reply
2 Replies

466 Views
Manjunathb
Contributor II
-> Here I attached code for reference, I updated code like this just i configured one gpio and do read and write operation ?
 
/*
 * Copyright (c) 2015, Freescale Semiconductor, Inc.
 * Copyright 2016-2017 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_rgpio.h"
#include "app.h"

/*******************************************************************************
 * Definitions
 ******************************************************************************/

/*******************************************************************************
 * Prototypes
 ******************************************************************************/
/*!
 * @brief delay a while.
 */
void delay(void);

/*******************************************************************************
 * Variables
 ******************************************************************************/

/*******************************************************************************
 * Code
 ******************************************************************************/

/*!
 * @brief Main function
 */
int main(void)
{
    /*[Manually]-> Define the init structure for the GPIO input*/
    rgpio_pin_config_t input_config = {
        kRGPIO_DigitalInput,
        0,
    };

    /* Board pin, clock, debug console init */
    BOARD_InitHardware();

    /* Print a note to terminal. */
    PRINTF("\r\n The GPIO start reading state.....\r\n");

    /* Init output LED GPIO. */
    RGPIO_PinInit(BOARD_LED_RGPIO, BOARD_LED_RGPIO_PIN, &input_config);

    while (1)
    {
        uint32_t val = RGPIO_PinRead(BOARD_LED_RGPIO,BOARD_LED_RGPIO_PIN);
        PRINTF("The Current value of GPIO%d is : %d\r\n",BOARD_LED_RGPIO_PIN,val);
        SDK_DelayAtLeastUs(500000U, SystemCoreClock);
    }
}
########################################################
/*
 * Copyright 2022 NXP
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/***********************************************************************************************************************
 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
 **********************************************************************************************************************/

/*
 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Pins v12.0
processor: MIMX9352xxxxM
package_id: MIMX9352DVVXM
mcu_data: ksdk2_0
processor_version: 0.12.3
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
 */

#include "pin_mux.h"

/* FUNCTION ************************************************************************************************************
 *
 * Function Name : BOARD_InitBootPins
 * Description   : Calls initialization functions.
 *
 * END ****************************************************************************************************************/
void BOARD_InitBootPins(void)
{
    BOARD_InitPins();
}

/*
 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', coreID: cm33}
- pin_list:
  - {pin_num: F20, peripheral: LPUART2, signal: lpuart_rx, pin_signal: UART2_RXD, HYS: DISABLED, FSEL1: SlOW_SLEW_RATE, DSE: NO_DRIVE}
  - {pin_num: F21, peripheral: LPUART2, signal: lpuart_tx, pin_signal: UART2_TXD, HYS: DISABLED, PD: DISABLED, FSEL1: SlOW_SLEW_RATE}
  - {pin_num: L17, peripheral: GPIO2, signal: 'gpio_io, 04', pin_signal: GPIO_IO04, HYS: DISABLED}
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
 */

/* FUNCTION ************************************************************************************************************
 *
 * Function Name : BOARD_InitPins
 * Description   : Configures pin routing and optionally pin electrical features.
 *
 * END ****************************************************************************************************************/
void BOARD_InitPins(void) {                                /*!< Function assigned for the core: undefined[cm33] */
    // IOMUXC_SetPinMux(IOMUXC_PAD_GPIO_IO04__GPIO2_IO04, 0U);
    IOMUXC_SetPinMux(IOMUXC_PAD_UART2_RXD__LPUART2_RX, 0U);
    IOMUXC_SetPinMux(IOMUXC_PAD_UART2_TXD__LPUART2_TX, 0U);

    /* Manually added (start)*/
    IOMUXC_SetPinMux(IOMUXC_PAD_GPIO_IO13__GPIO2_IO13, 0U);
    IOMUXC_SetPinConfig(IOMUXC_PAD_GPIO_IO13__GPIO2_IO13,
    /* Manually added (End)*/

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

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

/*******************************************************************************
 * Definitions
 ******************************************************************************/
/*${macro:start}*/
#define BOARD_LED_RGPIO          GPIO2
#define BOARD_LED_RGPIO_PIN      13U
#define EXAMPLE_RGPIO_CLOCK_ROOT kCLOCK_Root_BusWakeup
#define EXAMPLE_RGPIO_CLOCK_GATE kCLOCK_Gpio2
/*${macro:end}*/

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

#endif /* _APP_H_ */
0 Kudos
Reply

396 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi  Manjunathb

 

The MaaxBoard is manufactured and supported by Element14 , I would suggest you to reach out the owner so they maybe able to provide more insights on their BSP and their board.

 

MaaXBoard OSM93 - element14 Community

MaaXBoard Hardware Design - element14 Community

  

You also can refer to NXP MCUXpresso SDK for i.MX 93 EVK.

you can download the SDK from 

MCUXpresso SDK Builder

We have TPM and GPIO / timer demos inside the package.

 

Regards

Daniel

 

 

 

 

 

Regards

Daniel

0 Kudos
Reply