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/DK-TM4C129X: GPIO configuration

Part Number: DK-TM4C129X

Tool/software: TI-RTOS

Hi,

In my project I have to toggle PT3 pin in every two seconds.For this purpose, I seached GPIO toggling.I can not find any functions like GPIOPinToggle(BASE,PINNO) although GPIO_toggle() looks good.It is used with Board_LED0 but I can not implemented it with PT3.How can I do it? I made this operation in a discreate task and slept it 2 seconds with Task_sleep(2000); Is that enough to 2 secs. sleeps or could I use a timer ? Thanks for your answers. Best Regards.

Cengizhan YAPICIOĞLU

  • Search for an example project called blinky or heartbeat
  • Hi,
    If you are using TI-RTOS then GPIO_toggle() is the API to toggle the pin. Please see this link for more details on all the supported APIs for GPIO module. software-dl.ti.com/.../_g_p_i_o_8h.html

    You will need to either add or modify gpioPinConfigs structure in the DK_TM4C129X.c to define the PT3 signal. Please refer to the section 5.5 of the TI-RTOS User's Guide on GPIO driver.
  • hi,

    In DK_TM4C129X.c replace the pin related to Board_LED0( in section something like initGPIO) with the pin required by you.

    /* GPIO configuration structure */

    const GPIO_HWAttrs gpioHWAttrs[DK_TM4C129X_GPIOCOUNT] = {

       {GPIO_PORTT_BASE, GPIO_PIN_3, GPIO_OUTPUT}, /* DK_TM4C129X_LED_G */

       {GPIO_PORTQ_BASE, GPIO_PIN_4, GPIO_OUTPUT}, /* DK_TM4C129X_LED_B */

       {GPIO_PORTN_BASE, GPIO_PIN_5, GPIO_OUTPUT}, /* DK_TM4C129X_LED_R */

       {GPIO_PORTP_BASE, GPIO_PIN_1, GPIO_INPUT},  /* DK_TM4C129X_BUTTON_SELECT */

       {GPIO_PORTN_BASE, GPIO_PIN_3, GPIO_INPUT},  /* DK_TM4C129X_BUTTON_UP */

       {GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_INPUT},  /* DK_TM4C129X_BUTTON_DOWN */

    };

    Void DK_TM4C129X_initGPIO(Void)

    {

       /* Setup the LED GPIO pins used */

       GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_5); /* DK_TM4C129X_USER1 */

       GPIOPinTypeGPIOOutput(GPIO_PORTT_BASE, GPIO_PIN_3); /* DK_TM4C129X_USER1 */

       GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_4); /* DK_TM4C129X_USER1 */

       /* Setup the button GPIO pins used */

       GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_1);

       GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_1, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

       GPIOPinTypeGPIOInput(GPIO_PORTN_BASE, GPIO_PIN_3);

       GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_3, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

       GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_5);

       GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

       /* Once GPIO_init is called, GPIO_config cannot be changed */

       GPIO_init();

    }

    Regards,

    Digvijay