EDMA with UART5 on Tower K64

取消
显示结果 
搜索替代 
您的意思是: 

EDMA with UART5 on Tower K64

322 次查看
razed11
Contributor V

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.

标记 (1)
0 项奖励
1 回复

205 次查看
mjbcswitzerland
Specialist V

Kenny

The K64 UARTs 4 and 5 have a single DMA channel and so one can use either Rx DMA or Tx DMA on each but not both at the same time.

Regards

Mark