********************************************************************************
* Detailed Description:
*
* LINFlex UART TXFIFO transmit using DMA
* LINFlex UART mode with FIFO receive using DMA
*
*
* EVB connection:
*
* Route LINFlexD_0 TXD/RXD (PB2/PB3) signals to the main board RS-232 transceiver
* Daughtercard:
* J17.11–12 ON .. Connect LINFlexD_0 TXD (PB2) to main board.
* J17.8–9 ON .. Connect LINFlexD_0 RXD (PB3) to main board.
*
* Motherboard
* J14 - SCI_RX ON
* J13 - SCI_TX ON
* J25 - SCI_PWR ON
*
* See results on PC terminal (baudrate 19200, Data bits 8, Stop bits 1, Parity none).
*
* ------------------------------------------------------------------------------
* Test HW: MPC57xx
* Maskset: 1N65H
* Target : internal_FLASH (debug mode, release mode without debugging information)
* Fsys: 200 MHz PLL with 40 MHz crystal reference
* Terminal: 19200, 8N1, None
********************************************************************************
Martin,
I have read over the MPC5744P-Uart_with_DMA-S32DS.c implementation file and have a couple of questions. I am new to using the DMA and UART on this micro and could use some pointers.
I am guessing that the DMA_RX_Init() sets up the DMA to receive data from the UART and the DMA will auto-increment as new data is received from the UART. In this example, the RX buffer is local to the main:
uint8_t Receive_buffer[100];
This is of course not practical for a real application as after 100 chars you have exceed the local and you are writing areas of the stack that you should not be. In a real application you would want to do the following:
1) Disable DMA from transferring more characters from the UART
2) Retrieve the received characters from the target address (Receive_buffer[])
3) Reset the DMA target pointer and re-enable it to store data at the beginning of Receive_buffer[].
Questions:
1) Are the number of bytes received from the UART by the DMA available within the DMA unit?
2) How do you prevent overruns on your target address (Receive_buffer[]) if there is no length limit given to the DMA?
3) What is the most efficient means to retrieve the received data and set the DMA up to perform the next transfer?
I have a bi-direction 500KB serial channel and would like to use the DMA. When using buffered mode in the UART I am seeing overruns on the receiver. It appears that the only way I can use the FIFO capability (4 bytes?) is to use the DMA.
Any pointers that you have would be appreciated.
Thanks in advance.
Heath