Zynq PicoZed 7030 TCP/IP Not Initializing

I’m working on getting my network interface working on a custom Zynq PicoZed 7030 project. I have FreeRTOS running on it.

I downloaded the FreeRTOS-Plus-TCP files and added them to my Vitis tool. I added a FreeRTOSIPConfig.h to set up some defines. I’m following the tutorial for this, but I’m getting an error when calling FreeRTOS_IPInit_Multi:
Assert failed in file …/src/FreeRTOS-Plus-TCP-main/source/FreeRTOS_IP.c, line 946

Here’s my FreeRTOSIPConfig.h file:

#ifndef FREERTOS_IP_CONFIG_H
#define FREERTOS_IP_CONFIG_H

#define ipconfigUSE_DHCP 0
#define ipconfigUSE_DHCPv6 0
#define ipconfigUSE_IPv4 1
#define ipconfigUSE_IPv6 0

#define ipconfigNETWORK_MTU 1526
#define ipconfigTCP_MSS 1460
#define ipconfigTCP_TX_BUFFER_LENGTH ( 16 * ipconfigTCP_MSS )
#define ipconfigTCP_RX_BUFFER_LENGTH ( 16 * ipconfigTCP_MSS )

#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN

#define ipconfigZERO_COPY_RX_DRIVER 1
#define ipconfigZERO_COPY_TX_DRIVER 1

//#define ipconfigPORT_SUPPRESS_WARNING 1

#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
#define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 1

#define ipconfigNIC_N_TX_DESC 4
#define ipconfigNIC_N_RX_DESC 64 // 64 correct?

#define ipconfigUSE_DNS 0

#endif // FREERTOS_IP_CONFIG_H

Here’s my mainline code:

static uint8_t ucMACAddress[6] = { 0x00, 0x0A, 0x35, 0xE5, 0xE5, 0x5E };
static const uint8_t ucIPAddress[4] = { 192, 168, 1, 68 };
static const uint8_t ucNetMask[4] = { 255, 255, 255, 0 };
static const uint8_t ucGatewayAddress[4] = { 10, 10, 10, 1 };
static const uint8_t ucDNSServerAddress[4] = { 208, 67, 222, 222 };
static NetworkInterface_t * xInterfaces;
static NetworkEndPoint_t * xEndPoints;

FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints[ 0 ] ), ucIPAddress,
        ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );

FreeRTOS_IPInit_Multi();

vTaskStartScheduler();

Do I need to initialize anything else before calling these functions?

Any help would be appreciated.

THANKS!

I realized I might be missing this from the tutorial:
pxWinPcap_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );

I couldn’t find that function, but I did find this:
pxZynq_FillInterfaceDescriptor(0, &( xInterfaces[0]));

After adding this and a function prototype, it didn’t seem to help. I’m getting the same error.

Hi @dougr,
Welcome to FreeRTOS community!

That assertion means no network interface or endpoint added before calling FreeRTOS_IPInit_Multi(). Make sure that you add interface first, then use that interface as input while adding endpoint. You can take FreeRTOS_Plus_TCP_Echo_Posix as reference.

One other point is that your network interface/endpoint are declared as pointer. Make sure that they have memory. Here for your reference.

Thanks.

2 Likes

Thanks. I had to declare the variables as you described. I only declared them as pointers.

Now, it gets past the function calls.

Ok, next issue. I’m getting a failure on the FreeRTOS_socket function call:

pxZynq_FillInterfaceDescriptor(0, &( xInterfaces[0]));

FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints[ 0 ] ), ucIPAddress,
		ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );

FreeRTOS_IPInit_Multi();

xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET4,      <== this call fails
		FREERTOS_SOCK_STREAM , FREERTOS_IPPROTO_TCP );
configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );

Did you have a look at

regarding possible return codes ?

Yes, I see it’s about memory allocation failure, but I’m not sure what is implemented since I used the Vitis tool to start the FreeRTOS project. It sets up most of the project for you.

In any case, I found FreeRTOSConfig.h and found this line:
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65536 ) )

which I changed to:
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 64*65536 ) )

I’m assuming this is in bytes? I changed it and it still fails.

I can’t find the heap_1/2/3/4/5.c files in Vitis so I’m not sure what is implemented.

Hi @dougr,
Could you check if configSUPPORT_DYNAMIC_ALLOCATION is enabled? Refer to Memory Management for more detail.

BTW, it’s not a good idea to create a socket before calling vTaskStartScheduler() (To get fully support on kernel services). Would you like to move that call of FreeRTOS_socket() into task?

And, could you help to create a new post to discuss this new issue?

Thanks.