FreeRTOS +TCP on SAME70

No, i think you’re right, the check for link status returns low for me, too.

What’s confusing is, the system seems to detect a difference though when probing for the connection status. Here’s with my ethernet cable plugged in (running the ECHO test):

FreeRTOS_IPInit
vTaskStartScheduler
prvIPTask started
prvEthernetUpdateConfig: LS mask 00 Force 1
PHY ID 221560
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 3100
Network buffers: 17 lowest 17
Link status low - pxPhyObject->ulLinkStatusMask: 0
Network buffers: 16 lowest 16
Link status low - pxPhyObject->ulLinkStatusMask: 0
xPhyCheckLinkStatus: PHY LS now 01
Link status low - pxPhyObject->ulLinkStatusMask: 0
prvEthernetUpdateConfig: LS mask 01 Force 0
vApplicationIPNetworkEventHook: event 1
prvInitialiseDHCP: start after 250 ticks
vDHCPProcess: discover
Autonego ready: 0000786d: full duplex 100 mbit high status
Network buffers: 15 lowest 15
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vDHCPProcess: discover
vDHCPProcess: timeout 10000 ticks
Network buffers: 14 lowest 14
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vDHCPProcess: discover
vDHCPProcess: timeout 20000 ticks
Network buffers: 13 lowest 13
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
xPhyCheckLinkStatus: PHY LS now 00
Link status low - pxPhyObject->ulLinkStatusMask: 0
prvEthernetUpdateConfig: LS mask 00 Force 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vDHCPProcess: giving up 40000 > 30000 ticks
vApplicationIPNetworkEventHook: event 0
IP Address: 192.168.42.35
Subnet Mask: 255.255.255.0
Gateway Address: 192.168.42.1
DNS Server Address: 192.168.42.1
Socket 7 -> 0ip:0 State eCLOSED->eTCP_LISTEN
FreeRTOS_connect: 17724 to c0a82afcip:7
Socket 17724 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
Network buffers: 13 lowest 12

And here with the cable removed:

FreeRTOS_IPInit
vTaskStartScheduler
prvIPTask started
prvEthernetUpdateConfig: LS mask 00 Force 1
PHY ID 221560
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 3100
Network buffers: 17 lowest 17
Link status low - pxPhyObject->ulLinkStatusMask: 0
Network buffers: 16 lowest 16
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
vApplicationIPNetworkEventHook: event 1
Link status low - pxPhyObject->ulLinkStatusMask: 0

As you can see, with the cable plugged in, there’s a successful auto negotiation and the system begins to try and submit packages, but fails. With the cable unplugged, no auto negotiation happens and the system waits for the cable to be plugged in (when plugging it in in this state, it also successfully detects it and reaches auto negotiation).

To test this on your side, could you please enable ipconfigETHERNET_AN_ENABLE in your FreeRTOSIPConfig.h and look for a “Autonego ready:” line in your debug output?

EDIT:

I can’t seem to add another answer to this topic (what’s the reasoning behind that??), so here’s some further investigation:

I’ve been digging around in the xPhyCheckLinkStatus function, and I think what we’re seeing is a false negative. The check that returned 0 is just used for determining how often the link should be checked. Also, i think there’s a small error in the logic.
I’ve modified the function like this:

BaseType_t xPhyCheckLinkStatus( EthernetPhy_t *pxPhyObject, BaseType_t xHadReception )
{
uint32_t ulStatus, ulBitMask = 1u;
BaseType_t xPhyIndex;
BaseType_t xNeedCheck = pdFALSE;

	if( xHadReception > 0 )
	{
		/* A packet was received. No need to check for the PHY status now,
		but set a timer to check it later on. */
		vTaskSetTimeOutState( &( pxPhyObject->xLinkStatusTimer ) );
		pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
		for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1 )
		{
			if( ( pxPhyObject->ulLinkStatusMask & ulBitMask ) == 0ul )
			{
				pxPhyObject->ulLinkStatusMask |= ulBitMask;
				FreeRTOS_printf( ( "xPhyCheckLinkStatus: PHY LS now %02lX\n", pxPhyObject->ulLinkStatusMask ) );
				xNeedCheck = pdTRUE;
			}
		}
	}
	else if( xTaskCheckForTimeOut( &( pxPhyObject->xLinkStatusTimer ), &( pxPhyObject->xLinkStatusRemaining ) ) != pdFALSE )
	{
		/* Frequent checking the PHY Link Status can affect for the performance of Ethernet controller.
		As long as packets are received, no polling is needed.
		Otherwise, polling will be done when the 'xLinkStatusTimer' expires. */
		for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1 )
		{
		BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ];

			if( pxPhyObject->fnPhyRead( xPhyAddress, phyREG_01_BMSR, &ulStatus ) == 0 )
			{
				if( !!( pxPhyObject->ulLinkStatusMask & ulBitMask ) != !!( ulStatus & phyBMSR_LINK_STATUS ) )
				{
					if( ( ulStatus & phyBMSR_LINK_STATUS ) != 0 )
					{
						pxPhyObject->ulLinkStatusMask |= ulBitMask;
					}
					else
					{
						pxPhyObject->ulLinkStatusMask &= ~( ulBitMask );
					}
					FreeRTOS_printf( ( "xPhyCheckLinkStatus: PHY LS now %02lX\n", pxPhyObject->ulLinkStatusMask ) );
					xNeedCheck = pdTRUE;
				}
			}
		}
		vTaskSetTimeOutState( &( pxPhyObject->xLinkStatusTimer ) );
		if( ( pxPhyObject->ulLinkStatusMask & ( ulBitMask >> 1 ) ) != 0 )
		{
			/* The link status is high, so don't poll the PHY too often. */
			printf( "Link status high - pxPhyObject->ulLinkStatusMask: %d\r\n", pxPhyObject->ulLinkStatusMask );
			pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
		}
		else
		{
			/* The link status is low, polling may be done more frequently. */
			printf( "Link status low - pxPhyObject->ulLinkStatusMask: %d\r\n", pxPhyObject->ulLinkStatusMask );
			pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
		}
	}
	return xNeedCheck;
}

And now it reacts correctly to the status change and polls less often. Also, if i remove the cable and plug it back in the reaction is also correct.

FreeRTOS_IPInit
vTaskStartScheduler
prvIPTask started
prvEthernetUpdateConfig: LS mask 00 Force 1
PHY ID 221560
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 3100
Network buffers: 17 lowest 17
Link status low - pxPhyObject->ulLinkStatusMask: 0
Network buffers: 16 lowest 16
Link status low - pxPhyObject->ulLinkStatusMask: 0
xPhyCheckLinkStatus: PHY LS now 01
Link status high - pxPhyObject->ulLinkStatusMask: 1
prvEthernetUpdateConfig: LS mask 01 Force 0
vApplicationIPNetworkEventHook: event 1
prvInitialiseDHCP: start after 250 ticks
vDHCPProcess: discover
Autonego ready: 0000786d: full duplex 100 mbit high status
Network buffers: 15 lowest 15
vDHCPProcess: discover
vDHCPProcess: timeout 10000 ticks
Network buffers: 14 lowest 14
Link status high - pxPhyObject->ulLinkStatusMask: 1
vDHCPProcess: discover
vDHCPProcess: timeout 20000 ticks
Network buffers: 13 lowest 13
Link status high - pxPhyObject->ulLinkStatusMask: 1
vDHCPProcess: giving up 40000 > 30000 ticks
vApplicationIPNetworkEventHook: event 0
IP Address: 192.168.42.35
Subnet Mask: 255.255.255.0
Gateway Address: 192.168.42.1
DNS Server Address: 192.168.42.1
Socket 7 -> 0ip:0 State eCLOSED->eTCP_LISTEN
FreeRTOS_connect: 17724 to c0a82afcip:7
Socket 17724 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
Network buffers: 12 lowest 12
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
Network buffers: 11 lowest 11
Network buffers: 10 lowest 10
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Network buffers: 9 lowest 9
Network buffers: 0 lowest 0
Connect: giving up c0a82afcip:7
Socket 17724 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[17724 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 24121 to c0a82afcip:7
Socket 24121 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 24121 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[24121 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 8336 to c0a82afcip:7
Socket 8336 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
Link status high - pxPhyObject->ulLinkStatusMask: 1
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 8336 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[8336 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 24503 to c0a82afcip:7
Socket 24503 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 24503 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[24503 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 7276 to c0a82afcip:7
Socket 7276 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 7276 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[7276 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 4626 to c0a82afcip:7
Socket 4626 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 4626 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
Link status high - pxPhyObject->ulLinkStatusMask: 1
FreeRTOS_closesocket[4626 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 6273 to c0a82afcip:7
Socket 6273 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 6273 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[6273 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 13970 to c0a82afcip:7
Socket 13970 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 13970 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[13970 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 4090 to c0a82afcip:7
Socket 4090 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 4090 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[4090 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 22629 to c0a82afcip:7
Socket 22629 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
xPhyCheckLinkStatus: PHY LS now 00
Link status low - pxPhyObject->ulLinkStatusMask: 0
prvEthernetUpdateConfig: LS mask 00 Force 0
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 22629 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
FreeRTOS_closesocket[22629 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 8483 to c0a82afcip:7
Socket 8483 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 8483 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
FreeRTOS_closesocket[8483 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 24071 to c0a82afcip:7
Socket 24071 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 24071 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
FreeRTOS_closesocket[24071 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 24581 to c0a82afcip:7
Socket 24581 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
Connect: giving up c0a82afcip:7
Socket 24581 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
Link status low - pxPhyObject->ulLinkStatusMask: 0
Link status low - pxPhyObject->ulLinkStatusMask: 0
FreeRTOS_closesocket[24581 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 32301 to c0a82afcip:7
Socket 32301 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Link status low - pxPhyObject->ulLinkStatusMask: 0
Connect: giving up c0a82afcip:7
Socket 32301 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
xPhyCheckLinkStatus: PHY LS now 01
Link status high - pxPhyObject->ulLinkStatusMask: 1
prvEthernetUpdateConfig: LS mask 01 Force 0
FreeRTOS_closesocket[32301 to c0a82afcip:7]: buffers 0 socks 1
Autonego ready: 0000786d: full duplex 100 mbit high status
FreeRTOS_connect: 15158 to c0a82afcip:7
Socket 15158 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 15158 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[15158 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 26333 to c0a82afcip:7
Socket 26333 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 26333 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT
FreeRTOS_closesocket[26333 to c0a82afcip:7]: buffers 0 socks 1
FreeRTOS_connect: 2126 to c0a82afcip:7
Socket 2126 -> c0a82afcip:7 State eCLOSED->eCONNECT_SYN
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 1: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 2: 500 ms
ARP for c0a82afcip (using c0a82afcip): rc=0 00:00:00 00:00:00
Connect[c0a82afcip:7]: next timeout 3: 500 ms
Connect: giving up c0a82afcip:7
Socket 2126 -> c0a82afcip:7 State eCONNECT_SYN->eCLOSE_WAIT

So it’s pretty sure not the cause of the unability to send or receive packets.
I’ll dig further and see, if i can find anything.

EDIT 2:

I think i’ve found part of the problem.
gmac_dev_write checks if there’s TX buffers available by comparing
if ((p_tx_td->status.val & GMAC_TXD_USED) == 0)
which always returns 0, as the “status.val” member of all entries in gs_tx_desc are 0 (instead of 1ul << 31, as they should be).

Further looking at gmac_reset_tx_mem the line
gs_tx_desc[ul_index].status.val = GMAC_TXD_USED;
does nothing, after that, status.val is still 0, so the memory is not written.

To test that, i removed the
__attribute__ ((section(".first_data")))
from the variable declarations for ucNetworkPackets, gs_tx_desc, gs_tx_desc_null and gs_rx_desc, and gmac_dev_write stops returning GMAC_TX_BUSY as the variable contents can now be changed.
But that’s just treatment of symptoms, not the cause, as the packets still can’t get sent out.
gmac_start_transmission gets called, but doesn’t actually change the GMAC_NCR register.
I’ll have to dig deeper tomorrow, i think maybe it’s all related to the buffers?