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.

SK-TDA4VM: SK-TDA4VM EVM - Access SW3 from R7 microcontroller

Part Number: SK-TDA4VM
Other Parts Discussed in Thread: TDA4VM,

Tool/software:

We are doing a project where we want to read the SW3 user button state from one of the R7 microcontrollers on the TDA4VM.

We are using SDK 08_06_01 on the EVM development board (blue one).

We have modified the ipc-echo-test example and referred to the gpio blink test to see how the GPIO driver works.  We have modified the following files to try to iomux the WKUP_GPIO0_4 pin, documented by the EVM users guide to map the switch into the correct pin.

File: J721E_pinmux_data.c

static pinmuxPerCfg_t gWkup_gpio0PinCfg[] =
{
    /* MCU_MCAN1_TX -> WKUP_GPIO0_4 -> G25; As input*/
    {
        PIN_WKUP_GPIO0_4, PIN_MODE(7) | \
        ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
    },
    {PINMUX_END}
}
pinmuxBoardCfg_t gJ721E_WkupPinmuxData[] =
{
    {0, TRUE, gWkup_gpio0PinCfg},
    {PINMUX_END}
};
Then in our c code we have the following:
#define GPIO_SW3_PORT_NUM   0 /* Wakup GPIO0 */
#define GPIO_SW3_PIN_NUM    4 /* GPIO0_4 for SW3 according to */
#define SWITCH3_GPIO_INDEX  0
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] =
{
    /* Input pin with interrupt enabled */
    GPIO_DEVICE_CONFIG(GPIO_SW3_PORT_NUM, GPIO_SW3_PIN_NUM) | GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT
};

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

/* GPIO Driver configuration structure */
GPIO_v0_Config GPIO_v0_config =
{
    gpioPinConfigs,
    gpioCallbackFunctions,
    sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
    sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
    0x8U
};

// Setup GPIO for the EVM SW3 gpio
void SetupEvmGPIO()
{
    App_printf("Randys MCU_2_1 SetupEvmGPIO\r\n");
    //---------------- Board/HW init for GPIO ---------------------
    Board_initCfg boardCfg;
    GPIO_v0_HwAttrs gpio_cfg;

    /* Get the default configuration configurations */
    GPIO_socGetInitCfg(GPIO_SW3_PORT_NUM, &gpio_cfg);

     boardCfg = BOARD_INIT_PINMUX_CONFIG |
        BOARD_INIT_MODULE_CLOCK |
        BOARD_INIT_UART_STDIO;
    Board_init(boardCfg);

    /*== Will have to do other interrupt routing for maping wakeup gpio to main domain core. */
    /* change default GPIO port from MAIN GPIO0 to WAKEUP GPIO0 to access TP45 */
    gpio_cfg.baseAddr = CSL_WKUP_GPIO0_BASE;
    GPIO_configIntRouter(GPIO_SW3_PORT_NUM, GPIO_SW3_PIN_NUM, 0, &gpio_cfg);

    /* For J721E EVM, there is not GPIO pin directly connected to LEDs */
    /* J7ES: use WAKEUP GPIO0_6 --> TP45 for testing */
    /* Set the default GPIO init configurations */
    GPIO_socSetInitCfg(GPIO_SW3_PORT_NUM, &gpio_cfg);

    //---------------- SW init for GPIO ---------------------
    GPIO_init();

    /* Set the callback function */
    //GPIO_setCallback(SWITCH3_GPIO_INDEX, AppGpioCallbackFxn);

    /* Enable GPIO interrupt on the specific gpio pin */
    //GPIO_enableInt(SWITCH3_GPIO_INDEX);

    // Try to read button, Index into the GPIO_v0 config array
    uint32_t swVal = GPIO_read(SWITCH3_GPIO_INDEX);
    const uint8_t NUM_LOOPS = 100;
    for ( int i = 0; i < NUM_LOOPS; ++i)
    {
        UART_printf("SW3 VaLue is %d, loop %d of %d\r\n", swVal, i, NUM_LOOPS);
        App_printf("SW3 VaLue is %d, loop %d of %d\r\n", swVal, i, NUM_LOOPS);
        TaskP_sleep( 500 );
        swVal = GPIO_read(SWITCH3_GPIO_INDEX);
    }
}
The UART_print doesn't work but we are able to see the output in the remoteproc5 (mcu2_1)  trace output.
I cannot see the button state change.