Hi Dave,
You are on the right track.
I did a test using the lwip_ping_bm_frdmk64f example in KSDK_v2 using KDS_3.2.
The packet sent in this example finally ends up in ethernetif.c low_level_output() function. I made the following edits using #if 1's:
/* Send a multicast frame when the PHY is link up. */
if (kStatus_Success == PHY_GetLinkStatus(ENET, phyAddr, &link))
{
if (link)
{
#if 1 //DES 1=test, 0=default code
netif_set_link_up(&fsl_netif0);
#endif
if (kStatus_Success == ENET_SendFrame(ENET, &g_handle, pucBuffer, packetBuffer->tot_len - ETH_PAD_SIZE))
{
return ERR_OK;
}
}
#if 1 //DES 1=test, 0=default code
netif_set_link_down(&fsl_netif0);
#endif
}
My callback blinks the Blue LED fast when connected, and slow when disconnected.
#if 1 //DES 1=test, 0=default code
void delay(uint32_t loop_cnt, uint32_t blinks)
{
uint32_t i,j;
for(j=0;j<blinks*2;j++) {
LED_BLUE_TOGGLE(); //DES blink
for(i=0;i<loop_cnt;i++) //DES delay
{
__asm("nop");
}
}
}
void my_link_callback(void)
{
if(netif_is_link_up(&fsl_netif0)) { //DES link up blink fast
delay(1000000U, 8U);
}
else { //DES link down blink slow
delay(4000000U, 8U);
}
}
#endif
My main() had following:
netif_set_default(&fsl_netif0);
netif_set_up(&fsl_netif0);
#if 1 //DES 1=test, 0=default code
netif_is_link_up(&fsl_netif0);
netif_set_link_callback(&fsl_netif0, my_link_callback); //DES called when link transitions
#endif
LWIP_PLATFORM_DIAG(("\r\n************************************************"));
And I added PCR initialization to pin_mux.c BOARD_InitPins():
CLOCK_EnableClock(kCLOCK_PortB);
/* Affects PORTB_PCR16 register */
PORT_SetPinMux(PORTB, 16u, kPORT_MuxAlt3);
/* Affects PORTB_PCR17 register */
PORT_SetPinMux(PORTB, 17u, kPORT_MuxAlt3);
#if 1 //DES 1=test, 0=default code
/* Led pin mux Configuration */
PORT_SetPinMux(PORTB, 21U, kPORT_MuxAsGpio); //DES Blue LED on PTB21
#endif
Regards,
David