AnsweredAssumed Answered

EDMA with UART5 on Tower K64

Question asked by Kenny Koller on Dec 14, 2018
Latest reply on Dec 14, 2018 by Mark Butcher

I am using the Tower system with a K64 and serial board. Starting with the EDMA UART example that comes with SDK 2.4.2 I modified the defines to use UART5 (the UART that connects to the serial board RS-232 level shifter). I simplified the body of the example in the following way:

 

UART_ReceiveEDMA(DEMO_UART, &g_uartEdmaHandle, &receiveXfer);

U32 count = ~0;

while (1)
{
    U32 subcount;

    UART_TransferGetReceiveCountEDMA(DEMO_UART, &g_uartEdmaHandle, &subcount);

    if (subcount != count)
    {
        count = subcount;

        printf("Count: %d\n", count);

    }

 

    sleep(10);
}

 

When I connect to a terminal emulator I can see the message sent using UART_SendEDMA (not shown).

 

If I press a key once I can see that the receive DMA buffer is immediately filled with that single character and the callback occurs. The count reported by the task remains at zero.

 

Is there a problem with using UART5? I noticed that there are not separate enumerations for RX and TX in the DMA MUX definition as there are for some UARTs but only kDmaRequestMux0UART5.

 

#define DEMO_UART UART5
#define DEMO_UART_CLKSRC kCLOCK_BusClk
#define DEMO_UART_CLK_FREQ 60'000'000
#define UART_TX_DMA_CHANNEL 0U
#define UART_RX_DMA_CHANNEL 1U
#define EXAMPLE_UART_DMAMUX_BASEADDR DMAMUX0
#define EXAMPLE_UART_DMA_BASEADDR DMA0
#define UART_TX_DMA_REQUEST kDmaRequestMux0UART5
#define UART_RX_DMA_REQUEST kDmaRequestMux0UART5
#define ECHO_BUFFER_LENGTH 8

 

Reading elsewhere it seems that there is no way to pull data from the receive buffer until the exact number is specified. I found this surprising as very often the number of bytes is unknown. For example, I am reading from a bar code scanner and the code ends with a carriage return. So I need the ability to pull data out of the buffer until I see that character.

Outcomes