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.

AM2434: Sysconfig FreeRTOS Bi-directional GPIO Configuration

Part Number: AM2434
Other Parts Discussed in Thread: SYSCONFIG

Customer is looking for guidance on using Sysconfig to configure GPIO for dynamically changing GPIO direction at runtime. This is in a FreeRTOS environment. Any example or guidance on this?

  • Hello Lawrence,

    When we configure any IP from sysconfig, we get a corresponding generated code at compile time. 

    In this example we are configuring CONFIG_GPIO2's Pin direction as Input which gets reflected in ti_drivers_config.h as:

    Fullscreen
    1
    #define CONFIG_GPIO2_DIR (GPIO_DIRECTION_INPUT)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    This macro "CONFIG_GPIO2_DIR" is in turn used in ti_drivers_config.c to actually set the direction by calling the API GPIO_setDirMode:

    Fullscreen
    1
    GPIO_setDirMode(baseAddr, CONFIG_GPIO2_PIN, CONFIG_GPIO2_DIR);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    If user wants to change the GPIO direction dynamically, he can call the API GPIO_setDirMode by varying the 2nd argument between GPIO_DIRECTION_INPUT and GPIO_DIRECTION_OUTPUT wherever required.

    There's no way to configure syscfg such that the code changes at runtime because it's a one time config taking effect at compile time.

    Does this answer the query?