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.

Can TivaWare support two UART in one project?

Hi,

I have run demo project udma_demo on Tiva-C TM4C1294 LaunchPad. I notice that UART0 function uses TivaWare as shown below:

    ConfigureUART();
	  UARTprintf("\033[2J\033[H");
    UARTprintf("uDMA Example\n");

    //
    // Show the clock frequency on the display.
    //
    UARTprintf("Tiva C Series @ %u MHz\n\n", g_ui32SysClock / 1000000);

UART1 does not use TivaWare. It uses low level configuration functions to setup. Now, I still use UART0 for echo message to Console, while I use UART1 only for a simple loopback (not use DMA). Can I use TivaWare for both UART0 and UART1? If it must be used separately, is there a method to do so?

Thanks,

TivaWare_C_Series-2.1.1.71

  • Hello Robert

    UARTprintf can be assigned to one UART. If you need to use 2 UART's then it must be with UARTGet or UARTPut API calls

    Regards
    Amit
  • Thanks. I only see UARTgets() in file utils/uartstdio.c. I don't see a UART number identifier.

    In that file, there is no UARTput, UARTPut. Could you give me more detail on these two functions? 

    int
    UARTgets(char *pcBuf, uint32_t ui32Len)

  • It's not part of stdio.

    Take a look at uart.h (or better the TIVAWare documentation)

    extern bool UARTCharsAvail(uint32_t ui32Base);
    extern bool UARTSpaceAvail(uint32_t ui32Base);
    extern int32_t UARTCharGetNonBlocking(uint32_t ui32Base);
    extern int32_t UARTCharGet(uint32_t ui32Base);
    extern bool UARTCharPutNonBlocking(uint32_t ui32Base, unsigned char ucData);
    extern void UARTCharPut(uint32_t ui32Base, unsigned char ucData);
    extern void UARTBreakCtl(uint32_t ui32Base, bool bBreakState);
    extern bool UARTBusy(uint32_t ui32Base);

    Robert
  • Hello Robert,

    Look at the example uart_echo. That shows UART0 using basic API's to send data. A similar function using TivaWare API's would get the job done for Receive path

    Regards
    Amit