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.

EK-TM4C1294XL: GPIOs Not Working

Part Number: EK-TM4C1294XL

I am using the EK-TM4C1294XL board and am trying to toggle pins PL0-PL3 of GPIOL but have only been able to toggle PL0.

To configure the port I am using the following function calls:

MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);

MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 );

To write a 0 I use:

MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_0 , 0 );

To write a 1 I use:

MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_0 ,1 );

Is there a reason why none of the following statements would work?:

MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_1 ,1 );

MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_2 ,1 );

MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3 ,1 );

Thanks for all your help.

Jorge

  • Hi,

      Your code is incorrect. It should be below. 

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_0 ,GPIO_PIN_0 );

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_1 ,GPIO_PIN_1 );

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_2 ,GPIO_PIN_2 );

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3 ,GPIO_PIN_3 );

    If you want to set all of them at the same time then you need to do as follows. 

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3  ,GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 );

  • Charles,

    Thanks for your reply.

    Could you please tell me what is the proper way to set the port pin to 0 or 1 using MAP_GPIOPinWrite()?

    Jorge

  • For example, you cannot do below. 

    MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3 ,1 );

    GPIO_PIN_3 is the bit 4 in the port as in 00001000b. Therefore, to set GPIO_PIN_3, you need to do MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3 ,0x8 ); When you do MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3 ,1 ), it has no effect because you are trying to set GPIO_PIN_0 instead. 

  • Thanks Charles.  Got it.