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.

CCS/TM4C123GH6PM: TM4C123 Launchpad GPIO Issue

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hello, 

I'm having multiple TM4C123 launchpads. I've written  a code in CCS to drive 4 leds using  Port C pin 4,5,6,7. 

The problem is using one launchpad all the 4 leds are working perfectly. But if I change the launchpad, the leds are not glowing. 

I checked with multimeter, on the working launchpad I'm getting 3v3 voltage on port C pins, but on the other launchpad I'm getting 0V. 

Here is the code:

int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);

while(1)
{
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 0xFF);
// GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_PIN_4);
SysCtlDelay(2000000);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 0);
SysCtlDelay(2000000);
}
}

Why does this happen??

Anything can be done to get the second launchpad pins working??

Regards

Praveen

  • Praveen,

    If that is ALL of your code, not even the first launchpad will work: you are not enabling the port C.

    For ANY peripheral, there are always some configuration tasks you need to do before using it:

    • Enable the related peripherals at a System Control level
    • Configure the pins associated to it
    • In the case of GPIO's, configure the pad

    I assume you downloaded Tivaware, correct? Take a loot at the blinky examples, particularly for the configurations.

    Try to look again at the Tivaware Driver manual, GPIO chapter, and understand what the parameters of GPIO functions do. Particularly regarding GPIOWrite, you need to inform 3 things: which PORT are you controlling, which PINS are you modifying, and what VALUE you want on those pins. As an aditional exercise, try to understand that your parameter 0xFF will also work for what you want, but is not really the best way of doing (tip: try to turn two leds on and one off with just one command line).

    Regards

    Bruno

  • Hello Bruno,

    Sorry for posting the wrong code. Here is the actual code written for port C.

    int main(void)
    {
    SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);

    while(1)
    {
    GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, 0xFF);
    SysCtlDelay(2000000);
    GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, 0);
    SysCtlDelay(2000000);
    }
    }

    I'm using tivaware 2.1.3.
    The above code worked on one launchpad, but didn't work for another.

    Regards
    Praveen
  • That looks better.
    In that case, there is something wrong with your hardware.
    - Is your code running on the target board (can you debug it?)
    - Can you test leds in a different port, or test other GPIO's?
    - Did you check all the jumpers on the Launchpad?
    Regards
    Bruno
  • Hello Bruno,

    From the testing,
    The code is running fine on the board. I'm able to debug it. Also I've tried other peripherals, they are working fine.
    Port A and Port D pins are working fine.
    But port C and port E pins are not working.
    The jumpers are same as on working board to the non working board.

    Regards
    Praveen
  • Praveen,
    It appears that either there is something shorting out your pins, or that side of your MCU is burned...
    Regards
    Bruno
  • Hello Bruno,

    Can by erasing flash and dumping the above file using flash programmer revive the pins??

    Regards
    Praveen