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.

Stellaris Serial COM UART Over PuTTY Not Working on TM4C1294XL

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi all,

I'm relatively new to development on the Tiva platform. I wrote some very simple test code that is close to one of the ADC tutorials.

However, I am for some reason having issues initializing the UART0 module. When I debug the code on my board, no lines of code after UARTStdioConfig(0, 115200, 16000000) are executed. Thus, when I look at the PuTTY console, which is connected to the correct COM port with the correct baud rate, I see nothing.

Any help with this would be greatly appreciated! I've attached my code to this post.

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/adc.h"

#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "utils/uartstdio.c"

//*****************************************************************************
//
// This function sets up UART0 to be used for a console to display information
// as the example is running.
//
//*****************************************************************************
void
InitConsole(void)
{
    //
    // Enable GPIO port A which is used for UART0 pins.
    // TODO: change this to whichever GPIO port you are using.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Configure the pin muxing for UART0 functions on port A0 and A1.
    // This step is not necessary if your part does not support pin muxing.
    // TODO: change this to select the port/pin you are using.
    //
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);

    //
    // Enable UART0 so that we can configure the clock.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    //
    // Use the internal 16MHz oscillator as the UART clock source.
    //
    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    //
    // Select the alternate (UART) function for these pins.
    // TODO: change this to select the port/pin you are using.
    //
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    //
    // Initialize the UART for console I/O.
    //
    UARTStdioConfig(0, 115200, 16000000);
}

int main(void) {
	InitConsole();

	// Create an array that will be used for storing the data read from the ADC FIFO.
	// It must be as large as the FIFO for the sequencer in use.  We will be using
	// sequencer 1 which has a FIFO depth of 4.
	uint32_t ui32ACCValues[4];

	volatile uint32_t reading1;
	volatile uint32_t reading2;
	volatile uint32_t reading3;

	// Set the clocking to run at 20 MHz (200 MHz / 10) using the PLL.  When
    // using the ADC, you must either use the PLL or supply a 16 MHz clock
    // source.
	SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
	                   SYSCTL_XTAL_16MHZ);

	// Enable both ADC0 and GPIO Port E
	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

	// Configure the three GPIO pins to be analog inputs
	GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 );

	// Use ADC0, sample sequencer 1
	// Want the processor to trigger the sequence and we want to use the highest priority.
	ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

	// Configure three steps in the ADC sequencer.
	ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH3);
	ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH2);
	ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH1|ADC_CTL_IE|ADC_CTL_END);

	// Enable ADC sequencer 1. This is the last step to ready the sequencer and ADC before we start them.
	ADCSequenceEnable(ADC0_BASE, 1);

	// Forever
	while(1) {
		// Clear the ADC status flag
		ADCIntClear(ADC0_BASE, 1);

		// Trigger the ADC conversion with software.
		ADCProcessorTrigger(ADC0_BASE, 1);

		// Wait for the conversion process to complete
		while(!ADCIntStatus(ADC0_BASE, 1, false)) { }

		// Read the ADC value from the ADC Sample Sequencer 1 FIFO.
		ADCSequenceDataGet(ADC0_BASE, 1, ui32ACCValues);

		// Add these final three lines to move the values into some variables with more friendly sounding names
		reading1 = ui32ACCValues[0];
		reading2 = ui32ACCValues[1];
		reading3 = ui32ACCValues[2];

		// print the values
		UARTprintf("AIN =\t%4d\t%4d\t%4d\r", reading1, reading2, reading3);

		int i = 0;
		while (++i < 100000); // pause temporarily
	}
}

Thanks,

Tom

  • Hello Tom,

    First set of item to check would be to run the hello example code binary on the EK-TM4C1294XL Connected LaunchPad. If that does not work switch to another Console application like TeraTerm. That will help isolate the issue.

    Also check in the device manager if the COM Port has been correctly enumerated as a Stellaris/Tiva COM Port and settings are correct there as well.

    Regards
    Amit
  • Hi Amit,

    I tried the hello example, and I was also unable to receive a transmission from the UART. I tried a different console application to the same result. I have confirmed that I am using the correct COM port.

    I previously had USB UART working on this device, so I am very confused about what could be causing this.

    - Tom

  • Hello Tom,

    Does the Serial Port show up in Device Manager?

    Regards
    Amit
  • Hello Tom,

    To isolate the issue, I suggest the following

    1. A simple program where UART on receiving anything from the PC blinks a LED.
    2. For RX side we can connect a scope and see if the device is indeed transmitting.
    3. Something that I am not in favor of but will keep it for the last if the above 2 are OK, is to try a Firmware Update of the on-board ICDI on the EK-TM4C1294XL Connected LaunchPad

    Regards
    Amit
  • Hi Amit,

    I tried running more of the provided example projects such as qs-rgb and uart_echo, and when I step through with the debugger, they both fail on ROM_SysCtlClockSet(). I cannot even step into these functions. I am not sure this is related to my original issue, but it seems to indicate that something is wrong with my installation of CCS or the board itself nonetheless.

    I also tried running my own code again, digging deeper, and I've discovered that I get stuck in an infinite loop in sysctl.c around line 1633. Apparently this means the PLL is not locking. I would appreciate any help in resolving this.

    Thanks,
    Tom
  • Hello Thomas,

    ROM functions when stepped will not show a source. Bypass the PLL by commenting out the function for SysCtlClockSet and see if the issue is indeed with the Oscillator.

    Regards
    Amit
  • Amit,

    When I comment out the clock set in the qs-rgb example program, and step through with the debugger, the good news is characters are printing over UART (when I give enough time of course). However a couple of things happen that I would not expect. First, I hit the segment of code that indicates an "external pin reset or other reset event occurred". Second, while I am able to continue execution after this, I hit the fault ISR in the middle of executing RGBInit(0). I am not sure this is related to the problem I was having with UART or not, or what the cause of this problem could be.

    UPDATE: Experimenting more with my own code. I am hitting the fault ISR there as well. I suspect that there may be a hardware problem.


    Thanks,
    Tom

  • Hello Thomas,

    Indeed, there must be something on the h/w. Could there be a problem with the supply being close to the lower limit?

    Regards
    Amit