@dougr, it could still be useful if you can show more code of your project.
When you fill in a socket address, it is recommended to set all fields. For instance like:
memset( &xBindAddress, 0, sizeof( xBindAddress ) );
xBindAddress.sin_len = sizeof( xBindAddress );
xBindAddress.sin_family = FREERTOS_AF_INET;
xBindAddress.sin_port = ( uint16_t ) ucPort;
xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
IThe above code makes me wonder what variable is ucPort
? It looks like an 8-bit variable? Can that hold a 16-bit port number?
About the network setup:
uint8_t ucMACAddress[6] = { 0x00, 0x0A, 0x35, 0xE5, 0xE5, 0x5E };
uint8_t ucIPAddress[4] = { 192, 168, 1, 68 };
uint8_t ucNetMask[4] = { 255, 255, 0, 0 };
uint8_t ucGatewayAddress[4] = { 10, 10, 10, 1 };
uint8_t ucDNSServerAddress[4] = { 208, 67, 222, 222 };
I am not sure if you use it, but with this setup you need a gateway to reach your gateway!
The network has an IPv4 address 192.168.0.0
You can ARP with all devices whose address is 192.168.x.x. When you want to reach an remote address of 10.10.10.1 you would need a gateway.
In other works, you are mixing a class A with a class C network.
Your netmask is OK/legal, but it should be noted that in most cases, class C address range has 254 hosts per network:
uint8_t ucIPAddress[4] = { 192, 168, 1, 68 };
uint8_t ucNetMask[4] = { 255, 255, 255, 0 };
In the above example, any host with 192.168.1.x can become a gateway.
#define ipconfigNIC_N_TX_DESC 4
#define ipconfigNIC_N_RX_DESC 64 // 64 correct?
Yes that is good. When the outgoing descriptors are busy, the network driver will wait for a free slot. A queue of 4 is more than enough because transmissions are very fast.
For incoming packets, we need more buffer space: the IP-task may be busy and we don’t want to drop incoming packets.
pxZynq_FillInterfaceDescriptor(0, &( xInterfaces[0]));
FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints[ 0 ] ), ucIPAddress,
ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
Just to make sure: the interface and endpoint structs that you pass here, should continue to exist as long as the IP-stack is being used. Please declare them as static variables in the file, usually main.c
Do not declare them on the stack of main()
, because the stack may get a new destination once the scheduler has started.