FreeRTOS +TCP on SAME70

About FreeRTOS+TCP has a pool of ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS network buffers.

A zero-copy driver passes the pointers of these buffers directly to the DMA. DriverSAM allocates GMAC_RX_BUFFERS network buffer for DMA reception in advance.
As for outgoing traffic, at most GMAC_TX_BUFFERS buffers are needed simultaneously.

UDP-sockets keep network packets in their buffer until they are read by the user ( by calling FreeRTOS_recvfrom() ).

It is important to tune these numbers well. I tend to log the actual usage ( calling uxGetMinimumFreeNetworkBuffers() ).

And so, when zero-copy is being used, the following equation must be true:

ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS > ( GMAC_TX_BUFFERS + GMAC_RX_BUFFERS + SPARE )

To suggest a practical example:

    #define GMAC_TX_BUFFERS                           2
    #define GMAC_RX_BUFFERS                           4
    #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS   16

Why do I write this? In my SAME70 testing project, I had a bad configuration, because GMAC_RX_BUFFERS > ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS.
This caused an assert during startup.

The above macro’s must be defined in your project’s FreeRTOSIPConfig.h file.