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?
Thanks
Hello,
Unfortunately, it is not possible to receive an unknown size packet. The DMA transfer is define by yourself so your workaround seems like it could work.
For a linked list example you can refer to the CMSIS library example code. You can download it from next link:
https://community.nxp.com/docs/DOC-334797
After download it, please check the GDMA Link List example located at the path <lpc43xx_path>/Examples/GPDMA/ Gpdma_Linklist
I hope it helps.
Best regards,
Felipe