This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/AM5728: GPIO driver index mapping

Part Number: AM5728

Tool/software: TI-RTOS

What index should be used for accessing pin GPIO1_0 of the AM572x?  Since there is no such thing as GPIO0 on AM572x, is it considered index=0?  Or in order to be more consistent with other devices (like AM437x which has GPIO0 and GPIO1) is it considered index=32?

Where is this defined in the code, and where is it described in the documentation?

  • The RTOS team have been notified. They will respond here.
  • For AM572x TRM, 27.1 General-Purpose Interface Overview. There are 8 GPIOs each with 32-pin, it is indexed from 1. So GPIO1, GPIO2, GPIO3 .... GPIO8. Pin is indexed from 0 to 31.

    Under GPIO driver pdk_am57xx_1_0_10\packages\ti\drv\gpio\soc\am572x, there is a gpio_soc.c. There is a GPIO_v1_hwAttrs define the 8 GPIO instances, you can see the instance index 0 pointing to GPIO_1, index 1 point to GPIO_2. So, GPIO1_0 is 0, not 32 if you count this way.

    Also you can see the GPIO LED toggling example,
    #if defined (idkAM571x)
    #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO2_REGS)
    #define GPIO_LED_PIN_NUM (0x15U)
    #endif

    #if defined (evmAM572x)
    #if defined (__TI_ARM_V7M4__)
    #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO1_REGS)
    #define GPIO_LED_PIN_NUM (0x10U)
    #else
    #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO7_REGS)
    #define GPIO_LED_PIN_NUM (0x08U)
    #endif
    #endif

    #if defined (evmAM572x) || defined (idkAM571x) || \
    defined (skAM437x) || defined (evmAM437x) || \
    defined (icev2AM335x) || defined (skAM335x) || defined (bbbAM335x)
    #define GPIO_BASE_ADDR GPIO_INTR_LED_BASE_ADDR
    #define GPIO_LED_PIN GPIO_LED_PIN_NUM
    #endif

    The GPIO pin is accessed by using GPIO_BASE_ADDR and GPIO_LED_PIN to avoid the confusion.

    Regards, Eric