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.

problem with UART

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C1294XL

I used the below program for UART0 and I got the output, but when i used the same program for other UART's by enabling  the corresponding peripheral and its respective base  im not getting output. 

what could be the problem?

#include <stdint.h>
#include <stdbool.h>
#include <hw_memmap.h>
#include <hw_types.h>
#include <gpio.h>
#include <sysctl.h>
#include <uart.h>

int main(void)
{

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

GPIOPinConfigure(0x00000001);
GPIOPinConfigure(0x00000401);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTEnable(UART0_BASE);
UARTCharPut(UART0_BASE, 'E');
UARTCharPut(UART0_BASE, 'n');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'r');
UARTCharPut(UART0_BASE, ' ');
UARTCharPut(UART0_BASE, 'T');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'x');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, ':');
UARTCharPut(UART0_BASE, ' ');

while (1)
{
if(UARTCharsAvail(UART0_BASE)) UARTCharPut(UART0_BASE, UARTCharGet(UART0_BASE));
}

}

  • Hello Rukmani,

    First of all you should have pasted the code for the "other" UART. Secondly. what are you using to interface between the PC and the other UARTs?

    Regards
    Amit
  • I'm using ccs compiler. we are using Putty  terminal for UART communication. 

    The program below is for UART7. Im not getting output.

    #include <stdint.h>
    #include <stdbool.h>
    #include <hw_memmap.h>
    #include <gpio.h>
    #include <sysctl.h>
    #include <uart.h>
    #include <interrupt.h>
    #include <tm4c123gh6pm.h>

    void dly(unsigned int ms)
    {
    ms=(SysCtlClockGet()/3.0)*ms/1000;
    SysCtlDelay(ms);
    }

    void UARTIntHandler()
    {
    UARTIntClear(UART7_BASE,UART_INT_RX);
    UARTCharPut(UART7_BASE,UARTCharGet(UART7_BASE));
    }

    int main(void)
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
    GPIOPinConfigure(0x00040001);
    GPIOPinConfigure(0x00040401);
    GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    UARTConfigSetExpClk(UART7_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8));
    UARTClockSourceSet(UART7_BASE, UART_CLOCK_SYSTEM);
    UARTEnable(UART7_BASE);

    UARTCharPut(UART7_BASE, 'E');
    UARTCharPut(UART7_BASE, 'n');
    UARTCharPut(UART7_BASE, 't');
    UARTCharPut(UART7_BASE, 'e');
    UARTCharPut(UART7_BASE, 'r');
    UARTCharPut(UART7_BASE, ' ');
    UARTCharPut(UART7_BASE, 'T');
    UARTCharPut(UART7_BASE, 'e');
    UARTCharPut(UART7_BASE, 'x');
    UARTCharPut(UART7_BASE, 't');
    UARTCharPut(UART7_BASE, ':');
    UARTCharPut(UART7_BASE, ' ');


    while (1)
    {
    //if(UARTCharsAvail(UART7_BASE)){ UARTCharPut(UART7_BASE, UARTCharGet(UART7_BASE));}
    }

    }

  • Hi,

    How do you connect your Tiva MCU UART7 to your PC?

    Post a schematic diagram of the connections from your Tiva MCU UART7 to your PC.

    - kel
  • So then the Virtual com port number in Putty is the same for both UARTS running concurrently on the very same TM4C platform?
  • Hello Kel

    Already asked the poster, seems that we will get the schematic and connection details only later.

    Regards
    Amit
  • Amit what leads you to believe the poster has any physical serial connections at all. The EK-TM4C1294XL at least has the UART configured sending datagrams direct to USB virtual port com3 in most Tivaware example code.

    Really like this new method to send UART serial data using the USB transport, seems to be more common than rigging serial ports into RS232 cables these days. I have not had much time to investigate how that magic is taking place at the Tiva program level but hey its great magic and works except for maybe lacking any Hardware hand shake. Days past it was common to use CTS/RTS for hardware handshake on the PCAT RS232 DTE interface.
  • Hello BP101

    It is essential we understand how the poster is setting up the test-rig

    Regards
    Amit