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.

PROCESSOR-SDK-J721S2: Question about GPIO pin value

Part Number: PROCESSOR-SDK-J721S2

Board: Customer equips J721s2

BSP: 8.6

Refer to the URL: e2e.ti.com/.../4668565

"... Before calling GPIO Init, define gpioPinConfigs[] with PIN | DIR.

"Where PIN should be a hexadecimal value 0xABCD

Where AB represents Port number and CD represents the Pin number. For example, for configuring WKUP_GPIO0_16: PIN = 0x0010"

Question: once we declare 0x0010 through GPIO_DEVICE_CONFIG() function, how system can tell whether the gpio pin is WKUP_GPIO0_16, not GPIO0_16?

- Wilson

  • Hi Wilson,

    I would recommend referencing the LED blink example, expecially the file that defines the pin configuration located in <PSDK RTOS install directory>/pdk_*/packages/ti/drv/gpio/test/led_blink/src/GPIO_board.c.

    Example definition for both WKUP_GPIO and MAIN_GPIO can be found:

    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] =
    {
    /* Input pin with interrupt enabled */
    GPIO_DEVICE_CONFIG(WKUP_GPIO, WKUP_GPIO_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_OUTPUT,

    /* Output pin */
    GPIO_DEVICE_CONFIG(MAIN_GPIO, MAIN_GPIO_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_OUTPUT,
    };

    Regards,

    Takuma

  • Hi, Takuma,

    I found GPIO_LED0_PORT_NUM was defined In the GPIO_board.h, but nothing uses MAIN GPIO0.

    #if defined (j721e_evm) || defined (j7200_evm) || defined (j721s2_evm) || defined (j784s4_evm)
    /* J7ES: use WAKEUP GPIO0_6 --> TP45 for testing */
    #define GPIO_LED0_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
    #define GPIO_LED0_PORT_NUM 0 /* use WAKEUP GPIO0 */
    #define GPIO_LED1_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
    #define GPIO_LED1_PORT_NUM 0 /* use WAKEUP GPIO0 */
    #endif

    In my case, inthe app_init.c,

    #define GPIO_MAIN_DOMAIN_0    (0)

    #define M8_GPIO (0x14) // W27: GPIO0_20 (MCASP1_AXR2)
    GPIO_PinConfig gpioPinConfigs[] =
    {
    GPIO_DEVICE_CONFIG(GPIO_MAIN_DOMAIN_0, M8_GPIO) | GPIO_CFG_OUTPUT
    };

    It maps to MAIN_GPIO0_20.

    So, still have no idea why 0 maps to WKUP_GPIO0 in LED sample, but it maps to main gpio0 in app_init.c

    - Wilson

  • Hi Wilson,

    Again, I will recommend reviewing the GPIO_board.c file (along with the h file), if not already.

    Specifically, this line from my previous post:  GPIO_DEVICE_CONFIG(MAIN_GPIO, MAIN_GPIO_PIN_NUM)

    If the GPIO_board.h is also used as reference in conjunction, there are definitions for WKUP_GPIO 0U, and MAIN_GPIO 1U. Your code defines the macro GPIO_MAIN_DOMAIN_0 used as the port number as 0, and that is most likely why WKUP_GPIO0 is being used instead of MAIN_GPIO0.

    Regards,

    Takuma

  • Hi, Fujiwara San,

    Thanks for your reply, but still have questions for you.

    1. Would you mind if let us know which version of SDK you recommend? We use SDK 8.6 and follow your instruction, we could not find the line you specified: GPIO_DEVICE_CONFIG(MAIN_GPIO, MAIN_GPIO_PIN_NUM);

    But we have read these in file:

    ========================================

    #include <ti/csl/soc.h>
    #include <ti/csl/csl_types.h>
    #include <ti/drv/gpio/GPIO.h>
    #include <ti/drv/gpio/soc/GPIO_soc.h>
    #include <ti/drv/gpio/test/led_blink/src/GPIO_board.h>


    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] =
    {
    /* Input pin with interrupt enabled */
    GPIO_DEVICE_CONFIG(GPIO_LED0_PORT_NUM, GPIO_LED0_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_OUTPUT,

    /* Output pin */
    GPIO_DEVICE_CONFIG(GPIO_LED1_PORT_NUM, GPIO_LED1_PIN_NUM) |
    GPIO_CFG_OUTPUT
    };

    /* GPIO Driver call back functions */
    GPIO_CallbackFxn gpioCallbackFunctions[] =
    {
    NULL,
    NULL
    };

    /* GPIO Driver configuration structure */
    GPIO_v0_Config GPIO_v0_config =
    {
    gpioPinConfigs,
    gpioCallbackFunctions,
    sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
    sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
    #if (__ARM_ARCH == 7) && (__ARM_ARCH_PROFILE == 'R') /* R5F */
    0x8U
    #else
    #if defined(BUILD_C7X)
    0x01U
    #else
    0x20U
    #endif
    #endif
    };

    ========================================

    In the LED sample code, both GPIO_LED0_PORT_NUM and GPIO_LED1_PORT_NUM are in wakeup domain, defined in the GPIO_board.h:

    #if defined (j721e_evm) || defined (j7200_evm) || defined (j721s2_evm) || defined (j784s4_evm)
    /* J7ES: use WAKEUP GPIO0_6 --> TP45 for testing */
    #define GPIO_LED0_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
    #define GPIO_LED0_PORT_NUM 0 /* use WAKEUP GPIO0 */
    #define GPIO_LED1_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
    #define GPIO_LED1_PORT_NUM 0 /* use WAKEUP GPIO0 */
    #endif

    2. The GPIO_board.c takes wakup_gpio and defined its port as 0. On the other hand, I could not locate the place of WKUP_GPIO 0U, nor MAIN_GPIO 1U in the GPIO_board.h. Therefore, I think we might refer to different version of SDK.

    3. Referred https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1122910/tda4vm-tda4vm-eco-dsi-interface-display-failed-with-vision-app-run-run_app_dof-sh?tisearch=e2e-sitesearch&keymatch=TDA4VM%20AND%20DSI%20AND%20interface%20AND%20run_app_dof.sh, In the vision_apps/platform/j721s2_evm/rtos/common/app_init.c, the macro GPIO_MAIN_DOMAIN_0 used as the port number as 0, and it helps us communicate with main_gpio0 correctly, but it did not explain why define GPIO_MAIN_DOMAIN_0 as 0 in vision_0801.patch.

    4. There must be a kind of mapping in between the definitions of WKUP_GPIO0/MAIN_GPIO0 and their base addresses. Would you please show us details?

    In summary, both GPIO_board.c and GPIO_board.h do not provide enough information to explain why giving 0 to WKUP_GPIO0. And what should assign to MAIN_GPIO0.

    - Wilson

  • Hi, Fujiwara San,,

    We found the LED sample program hardcoded the base address. This case is closed.

    - Wilson