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: Trouble with on-board LEDs

Part Number: TM4C129ENCPDT


When looking at the TM4C129E Launchpad manual, section 2.1.6 calls out the 4 on-board user LEDs, namely PN1, PN0, PF0, and PF4. The docs also state that PF0 and PF4 can be controlled by the Ethernet module. With that said, I have a use case where I’d like to blink all 4 LEDs when a fault occurs. To test my logic, I went over to the existing blinky example project and added a few lines:

#define PORTN_LEDS GPIO_PIN_0 | GPIO_PIN_1
#define PORTF_LEDS GPIO_PIN_0 | GPIO_PIN_4
#define PIN_HIGH 0x01
#define PIN_LOW 0x00

int main(void) {
  
    volatile uint32_t ui32Loop;
    
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION) && !SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF));
    
    // Set direction
    GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, PORTN_LEDS);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, PORTF_LEDS);
    
    while(1){
        
        // Turn pins on
        GPIOPinWrite(GPIO_PORTN_BASE, PORTN_LEDS, PIN_HIGH);
        GPIOPinWrite(GPIO_PORTF_BASE, PORTF_LEDS, PIN_HIGH);
        
        // Delay
        for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++);
        
        // Turn pins off
        GPIOPinWrite(GPIO_PORTN_BASE, PORTN_LEDS, PIN_LOW);
        GPIOPinWrite(GPIO_PORTF_BASE, PORTF_LEDS, PIN_LOW);
        
        // Delay
        for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++);
    }

    // Unreachable
    return 0;
}

The issue here is that only PN0 && PF0 blink. What's even more bizarre is that if I comment out:

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, PORTF_LEDS);

PF0 still blinks on GPIOPinWrite. I dug a bit deeper into the TM4C129E datasheet and have a hunch that there is an extra step that needs to happen in order to free the GPIO_PIN_0 and GPIO_PIN_4 on PORTF. I am wondering if somehow EN0LED[0-2] have taken control of the pins?

For now, the only code that gets executed is the main function pasted above. My main goal is to blink all 4 LEDs. I am 100 percent sure this is an issue on my end, I'm just not sure how to solve it.

Any help would be greatly appreciated. Thanks!