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/EK-TM4C1294XL: How to print the content of uart rx buffer to the serial console in ccs

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio

Hi 

I have here a gps module gy-neo6mv2 connected to my tiva launch pad through uart6 mounted on a truggy car. my question is how to print the content i get form "UARTCharGet" to the serial console

my idea is that to print always the coordinates that are sent by the gps to see where is my car

//PP0 -> RX , PP1 -> TX
void GPSPosition(void)
{
    uint32_t ui32Status;
    ui32Status = UARTIntStatus(UART6_BASE, true);       //get interrupt status
    UARTIntClear(UART6_BASE, ui32Status);               //clear the asserted interrupts
    gucRxChar = UARTCharGet(UART6_BASE);
//    printf("Coordinate : %c",gucRxChar);
    // i want to print the content here to the serial console 
    UARTCharPut(UART0_BASE, gucRxChar);
}

and here is the configuration for the uart

//PP0 -> RX , PP1 -> TX
void UARTConfigGPS(void) {
    SYSCTL_RCGCGPIO_R |= (1 << 13);              // port P
    while (!(SYSCTL_PRGPIO_R & (1 << 13)))
        ;
    GPIO_PORTP_DEN_R |= 0x03;                    // enable pin PP0, PP1
    GPIO_PORTP_AFSEL_R |= 0x03;                  // enable alternate function
    GPIO_PORTP_PCTL_R |= 0x01;                   // enable U6Rx

    SYSCTL_RCGCUART_R |= (1 << 6);               // UART 6
    while (!(SYSCTL_PRUART_R & (1 << 6)))
        ;
    UART6_CTL_R &= ~0x01;                        // disable the UART6
    //  UART4_IBRD_R = 17;                       // baud rate of 57600 bit/s
    //  UART4_FBRD_R = 23;
    //  BRD = 104.16666667
    UART6_IBRD_R = 104;                          // baud rate of 9600 bit/s
    UART6_FBRD_R = 10;
    UART6_LCRH_R = 0x60;                         // 8N1    bits frame and no parity bit
    UART6_CTL_R |= 0x201;                        // enable the UART6 as Rx
    UART6_ICR_R = 0xE7FF;                        // clear all interrupts
    UART6_IM_R |= 1 << 4;                        // activate UART6 Rx interrupts
    NVIC_EN1_R |= 1 << (59-32);                  // enable UART6 interrupt in the nested vector interrupt controller
}

thanks in advance

  • If by "serial console" you mean the serial virtual port that is created on your PC and connected to UART0 by the USB cable on the debug port, you have the right idea. You read from UART6 and write it out on UART0. However, you need to initialize UART0 like you did for UART6. We strongly recommend the use of the TivaWare library functions for the initialization instead of the direct register reads and writes that you used. Take a look at the example in "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl\hello".

    //*****************************************************************************
    //
    // Configure the UART and its pins.  This must be called before UARTprintf().
    //
    //*****************************************************************************
    void
    ConfigureUART(void)
    {
        //
        // Enable the GPIO Peripheral used by the UART.
        //
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
        //
        // Enable UART0
        //
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    
        //
        // Configure GPIO Pins for UART mode.
        //
        ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
        ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
        ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        //
        // Initialize the UART for console I/O.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
    }
    

  • hey bob

    yeah this worked for me. many many thanks.

    best regards
    Hesham