Uart DMA transfer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Uart DMA transfer

803 Views
pietrodicastri
Senior Contributor II

Good morning

I am testing the example uart_edma_transfer  for the SDK 2.0. On the FRDM K64.

I have modified the serial port, it is the 1 now. The pin mux are updated as well.

The buffer length is now 128.

I also initialize the tx buffer to some sequential numbers.

The source is attached.

I short on the board the PTC3 and PTC4, The pin 16 of J1 to the pin 4 of J2.

I see the data going out on the scope. The end of rx transfer is never got.

 

Suggestions....

Original Attachment has been moved to: uart_edma_transfer.c.zip

Labels (1)
Tags (2)
0 Kudos
1 Reply

473 Views
isaacavila
NXP Employee
NXP Employee

Hello,

Your modifications are correct, however, you are not seeing Rx transfer to be finished because it "never" received data.

Current example was created as follows:

  • Once everything is started, UART0 sends to console the welcome message.
  • Once it is sent completely, then UART0 request a RX transfer.
  • When data is received (8 for default example, 128 for your case) then RX transfer will be finished and received data will be sent back.

As you are connection Rx to Tx, you are not "receiving data" on Rx once the welcome message has been sent. That is why Rx transfer never finishes.

You will need to send data to Rx after UART_ReceiveEDMA(DEMO_UART, &g_uartEdmaHandle, &receiveXfer); is called.

A simple workaround to "emulate" that user has sent data, would be:

        /* If RX is idle and g_rxBuffer is empty, start to read data to g_rxBuffer. */
        if ((!rxOnGoing) && rxBufferEmpty)
        {
            rxOnGoing = true;
            UART_ReceiveEDMA(DEMO_UART, &g_uartEdmaHandle, &receiveXfer);
            UART_SendEDMA(DEMO_UART, &g_uartEdmaHandle, &sendXfer);
        }

And then you will be able to receive all data on your rxBuffer.

I hope this helps!

Regards,
Isaac