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.
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.
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