Hello, how would I possibly go about testing the LED on the TivaC TM4C123GXL device? I've looked through hours of instruction videos online and the
documentation to set up the LED blink program but I cannot get this device to work. I downloaded KEIL Uvision V5 and I have the Stellaris ICDI selected in the debugger tab.
I'll post my sample code down below that I found. The LED does come on, but I cannot get it to shut off. I have the drivers installed and I have multiple sample programs
that basically come to the same conclusion, a static LED. I went into the debugger and saw that the DATA register was being toggled on and off when you open
the debug session> system viewer windows drop down list> GPIO>GPIOF, you will see the first box called DATA. When you run the program below you will see that these
two addresses are toggled: 0x00000002 and 0x00000000. This should indicate that the red LED should be turning on and off. But on my board it stays static.
Can anyone help me with this? This code is something I got online to try to get this board working. It seems to be the only one that I found that seems to be blinking
something. I know this is kind of a noob question, but I'm just trying to learn about embedded systems, been fighting with this all weekend, I'm out of resources to try to find the what the issue is.
I thought it was the code but now I'm not so sure. Thank you all for your time. If there is anything you need let me know and I'll get it to you as fast as I can.
#include "TM4C123.h" // Device header #include <stdlib.h> //General Input/ouput Run Mode Clock Gating Control RCGCGPIO pg 340 //This enables our F port #define SYSCTL_RCGCGPIO_R (*((volatile unsigned long *) 0x400FE608)) //GPIO direction binary (000000000001110),we choose this because according to //pg 663, we must choose which pins in port F we want to be either an input or output. #define GPIO_PORTF_DIR_R (*((volatile unsigned long *) 0x40025400)) //Digial enable or DEN pg 683 page number 682-683 //The digital functions for the corresponding pin are enabled //once you find the binary value for this setting convert to hexadecimal #define GPIO_PORTF_DEN_R (*((volatile unsigned long *)0x4002551C ))// base address + offset = 04x4002551C //GPIODATA see page 662 of the datasheet. base + offset is 0x40025000 + the pins we want to enable (bianry value: 0000011100) represent as hexadecimal as 0x038 //= 0x40025038 #define GPIO_PORTF_DATA_R (* (( volatile unsigned long *) 0x40025038)) //assign values to registers . The pin 1 enable button to have value 0x020 #define GPIO_PORTF_CLK_EN 0x20 //enable clock port F #define GPIO_PORTF_PIN1_EN 0x02 //pin position #define LED_ON1 0x02 // binary of the red pin or PF1: 000000000000010 #define GPIO_PORTF_PIN2_EN 0x04//PIN POSITION #define LED_ON2 0x04 // binary representation of Blue pin or PF2: 000000000000100 #define GPIO_PORTF_PIN3_EN 0x08 //pin position #define LED_ON3 0x08 // Binary representation of the green pin or PF3: 000000000001000 void Delay(void); static int j = 0; void Delay(void) { for (j=0; j<1000 ; j++); } int main (void) { //The “|=” operator is an OR operator and it will simply add the value at the right to the variable given at the left. volatile unsigned long ulLoop ; SYSCTL_RCGCGPIO_R |= GPIO_PORTF_CLK_EN ; ulLoop = SYSCTL_RCGCGPIO_R; GPIO_PORTF_DIR_R |= GPIO_PORTF_PIN1_EN ; GPIO_PORTF_DEN_R |= GPIO_PORTF_PIN1_EN ; GPIO_PORTF_DIR_R |= GPIO_PORTF_PIN2_EN ; GPIO_PORTF_DEN_R |= GPIO_PORTF_PIN2_EN ; GPIO_PORTF_DIR_R |= GPIO_PORTF_PIN3_EN ; GPIO_PORTF_DEN_R |= GPIO_PORTF_PIN3_EN ; while (1) { GPIO_PORTF_DATA_R &= LED_ON3; GPIO_PORTF_DATA_R &= LED_ON2; GPIO_PORTF_DATA_R |= LED_ON1; Delay(); GPIO_PORTF_DATA_R &= LED_ON3; GPIO_PORTF_DATA_R &= LED_ON2; GPIO_PORTF_DATA_R |= LED_ON1; Delay(); GPIO_PORTF_DATA_R &= LED_ON3; GPIO_PORTF_DATA_R &= LED_ON2; GPIO_PORTF_DATA_R |= LED_ON1; Delay(); } return 0; }