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.

TM4C129ENCPDT: How to set the GPIO pin has input

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: EK-TM4C129EXL

Hi 

I am using EK-TM4C129EXL evaluation kit. how to set the PN2 and PN3 as a input pin???. What will be the GPIO pin input voltage to detect ???? Shall i give 3.25 volt as a input voltage to the GPIO pin??

  • In data sheet it has mention as Fast GPIO pin high input voltage Min -0.35*Vdd to Max - 4 . So input voltage to the GPIO pin was 3.25Volt  because it was within the range. Whether it is possible to detect the signal orelse i have give 4 v??. little bit doubt. Please clarify it.

  • Hi ,
    I am using EK-TM4C129EXL evaluation kit, based on USRSWR to increment the value from 0 to 100 incrementally by 1
    // Test call using the User switch button0
    GPIO_setCallback(Board_BUTTON0, targetActualAppRstFxn);

    /* Enable interrupts */
    GPIO_enableInt(Board_BUTTON0);

    and set
    GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pins */
    /* EK_TM4C129EXL_USR_SW1 */
    GPIOTiva_PJ_0 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,

    In this concept when i pressed button it is incremented and working good.

    But based on the same concept i am using PN2 as a input pin and configured as same like above but directly connecting 3.3v regulated output to this pin and not using the switch button, but it is not incremented whether i made any mistake in my circuit or code ???
  • Hello Nishitha,

    Regarding the input voltage detection, you will see the GPIO detect a "High" on the pin from 0.65 * VDD at minimum (which would be 2.145V in a 3.3V sourced system) up to 4V. You want to avoid putting voltages near the upper limit though as 4V is the absolute maximum tolerance for the GPIO and any higher than that (except for specified USB pins) has the potential to damage the device.

    The minimum level of 0.35 * VDD means that anything at that voltage or below it will be detected as "Low". So for a 3.3V sourced system, anything at 1.155 V or lower will be seen as a low.

    3.25 V will be fine to test if you can detect a high.

    Regarding your code issue, can you post full code for the button initialization that works and the full code for your GPIO initialization that doesn't work so I can compare and see if I can notice the issue?
  • Hi Sir,

    Thank you so much for your reply... I understood the concept of voltage trigger. But in my code it is not trigger the interrupt. I don't know where i made the mistake.. 

    /* 
    *  ======== taAppCounterTaskFxn ========
    *  This is a task function managed by tasks. It is used
    *  to periodically check for the GPIO pins for TARGET / ACTUAL APPLICATION
    *  increment and reset interrupts
    *  The Task_sleep is determined by arg0 which
    *
    *  */

    GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pins */ Board User switch interrupts
    /* EK_TM4C129EXL_USR_SW1 */
    GPIOTiva_PJ_0 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
    /* EK_TM4C129EXL_USR_SW2 */
    GPIOTiva_PJ_1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,

    /* Output pins */
    /* EK_TM4C129EXL_USR_D1 */
    GPIOTiva_PN_1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    /* EK_TM4C129EXL_USR_D2 */
    GPIOTiva_PN_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,

    We Added 
    * */

    /* OUTPUT PINS */
    /* EK_TM4C129EXL_PL1 */
    GPIOTiva_PL_1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    /* EK_TM4C129EXL_PL2 */
    GPIOTiva_PL_2 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,

    /* INPUT PINS */ (interrupts)
    /* EK_TM4C129EXL_PN2 */
    GPIOTiva_PN_2 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, 
    /* EK_TM4C129EXL_PN3 */
    GPIOTiva_PN_3 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,


    Void taAppCounterTaskFxn (UArg arg0, UArg arg1)
    {
        while (1)
       {


           /* 2.1 */
           GPIO_setCallback(Board_COUNTER_RST, targetActualAppRstFxn); // We added 

           // Test call using the User switch button0
           //GPIO_setCallback(Board_BUTTON0, targetActualAppRstFxn);// board 

           /* Enable interrupts */
           GPIO_enableInt(Board_COUNTER_RST);//we added 
           //GPIO_enableInt(Board_BUTTON0); // board

           /* 2.2 */
           /* install Button callback */
           GPIO_setCallback(Board_COUNTER_INC, targetActualAppIncFxn);//we added 

           // Test call using the User switch button1
           //GPIO_setCallback(Board_BUTTON1, targetActualAppIncFxn);// board 

           /* Enable interrupts */
           GPIO_enableInt(Board_COUNTER_INC);//we added 
           //GPIO_enableInt(Board_BUTTON1);// board


           // Call this task once every 20ms or as specified for arg0 in main()
           Task_sleep((unsigned int)arg0);
       }
    }

    /*
    *  ======== heartBeatTaskFxn ========
    *  This is a task function managed by tasks. It is used
    *  to periodically run the row scanning at specified number of clock ticks
    *  based on the scanning requirements.
    *  The Task_sleep is determined by arg0 which
    *  is configured for the heartBeat Task instance.
    */
    Void heartBeatTaskFxn(UArg arg0, UArg arg1)
    {
       while (1)
       {
           System_printf(" hearBeatFxn running .. \n");
           /* SysMin will only print to the console when you call flush or exit */
           System_flush();


           // 1. Perform row Scanning and send data to LED driver via SPI
           ledDispRowScanFxn();


           // As all task functions are done, go to sleep
           Task_sleep((unsigned int)arg0);
           //GPIO_toggle(Board_LED0);
       }
    }


    /*
    *  ======== main ========
    */
    int main(void)
    {
       Task_Handle taskHandle1;
       Task_Params taskParams1;
       Error_Block eb;
       Task_Handle taskHandle2;
       Task_Params taskParams2;

       /* Call board init functions */
       Board_initGeneral();
       Board_initGPIO();
       Board_initEMAC();
       Board_initSPI();

       System_printf(" Heart beat function task created\n");
       /* SysMin will only print to the console when you call flush or exit */
       System_flush();

       // Create the LED Displays Application task
       /* Init the Error_Block */
       Error_init(&eb);

       /* Create a task for heart beat fxn for display scanning purpose */
       /* Initialize the defaults and set the parameters. */
       Task_Params_init(&taskParams1);
       taskParams1.arg0 =1;
       taskParams1.stackSize = TASK_STACK_SIZE;
       taskParams1.priority = 15;
       taskHandle1 = Task_create((Task_FuncPtr)heartBeatTaskFxn, &taskParams1, &eb);
       if (taskHandle1 == NULL) {
           System_printf("Error: Failed to create new Task\n");
           /* SysMin will only print to the console when you call flush or exit */
           System_flush();
       }

       /* Create a task for TARGET/ACTUAL application specific counter INCREMENTS and RESET */
       /* Initialize the defaults and set the parameters. */
       Task_Params_init(&taskParams2);
       taskParams2.arg0 =200;
       taskParams2.stackSize = TASK_STACK_SIZE;
       taskParams2.priority = 10;
       taskHandle2 = Task_create((Task_FuncPtr)taAppCounterTaskFxn, &taskParams2, &eb);
       if (taskHandle2 == NULL) {
           System_printf("Error: Failed to create new Task\n");
           /* SysMin will only print to the console when you call flush or exit */
           System_flush();
       }


       /* Start BIOS */
       BIOS_start();

       return (0);
    }

     

  • Nishitha,

    Can you please also post your modified Board.h and EK_TM4C129EXL.c files?

    And which version of TI-RTOS are you using?

    One thing to try if you haven’t, is to try holding these pins in high and low states and reading the level via GPIO_read().  Do you read the different logic levels as you expect?  This will help narrow the problem between basic configuration vs getting interrupts.

    Thanks,
    Scott

  • Hi
    Thank you for the reply, We found the issue, In GPIO_PinConfig gpioPinConfigs[] and GPIO call back array index sequence we missed. So only interrupt not generated now its working fine. Thanks you so much for your supports
  • We missed to read this notes: So only issues occured
    * Array of Pin configurations
    * NOTE: The order of the pin configurations must coincide with what was defined in EK_TM4C129EXL.h