As mentioned earlier we are using LPC4357 and UART1 is connected to an embedded Ethernet module. Trying to use DMA to receiver and transmit. On the receive path packet size is unknown.
When the packet size is unknown, one option is to use peripheral as the flow controller but UART can’t be flow controller.
One method that works (just received one packet) is the following. However, if you have some other more obvious or elegant methods please let us know.
Set the DMA controller as the flow controller and initially set the size as 2 bytes. First two bytes of the packet contains the size. So, first time when the interrupt occurs, get the packet size and reinitialize the size to the correct packet size.
Also, we would like to have a ring buffer or linked list data structure where some other task can process the packet. Do we need to use DMA descriptor? Do you have any documentation or examples?