heinbali01 wrote on Saturday, November 21, 2015:
First some remarks that have nothing to do with your “FreeRTOS_recv always return 1” problem. I had another look at the FreeRTOSIPConfig.h
that you posted earlier:
#define ipconfigARP_CACHE_ENTRIES 6
That is may too little: it will only have 6 ARP entries. If you have many connections, there will often be unnecessary ARP lookup’s because ealier entries were overwritten.
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 96
That is a lot. I would use that in a Xilinx Zynq, which has 1 GB of RAM available. In CPU’s with less RAM, 36 descriptors will be more than enough:
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 36
While developing, it is always good to keep an eye on the actual usage of network buffer descriptors, such as in this code:
{
uxCurrentCount = uxGetMinimumFreeNetworkBuffers();
if( uxLastMinBufferCount != uxCurrentCount )
{
/* The logging produced below may be helpful
while tuning +TCP: see how many buffers are in use. */
uxLastMinBufferCount = uxCurrentCount;
FreeRTOS_printf( ( "Network buffers: %lu lowest %lu\n",
uxGetNumberOfFreeNetworkBuffers(), uxCurrentCount ) );
}
}
TCP stream buffer size:
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
maximum size. Define the size of Rx buffer for TCP sockets. */
#define ipconfigTCP_RX_BUF_LEN ( 0x4000 )
/* Define the size of Tx buffer for TCP sockets. */
#define ipconfigTCP_TX_BUF_LEN ( 0x4000 )
That gives a RX (and TX) stream buffer of 16384 bytes. If you would omit to call recv(), the socket will receive up to that amount of bytes.
Note that you can always overwrite these default buffer sizes for individual sockets.
Back to the "FreeRTOS_recv
always return 1" problem:
It would be interesting to see a PCAP of the communication.
And maybe the code that creates a socket, binds and listens, calls to FreeRTOS_setsockopt()? If it is complete enough I can run it in a Xilinx Zynq (have no uBlaze here )
Regards,
Hein