<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do you detect (and handle!) a lwIP disconnection? in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509487#M5184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave did you ask him?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to use&amp;nbsp;PHY_DRV_GetLinkStatus but linkstatus always return false, so it did not work for me.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;bool PHY_Get_Initialized_LinkStatus() {
// return true;
 if (!g_initialized) return false;
 bool linkstatus = false;
 int timeout = 10;
 uint32_t result;
 int count = 0;
 while ((count &amp;lt; timeout) &amp;amp;&amp;amp; (!linkstatus)) {
 result = PHY_DRV_GetLinkStatus(g_devNumber,g_enetIfPtr-&amp;gt;phyAddr,&amp;amp;linkstatus);
// if (result == kStatus_ENET_Success) {
// PRINTF("result == kStatus_ENET_Success, linkStatus = %d\r\n", linkstatus);
// return (linkstatus);
// } else {
// PRINTF("result == kStatus_ENET_Failed\r\n");
// return false;
// }
 count++;
 }
 if (count == timeout)
 {
 return false;
 } else {
 return true;
 }
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2018 05:05:00 GMT</pubDate>
    <dc:creator>n_2t</dc:creator>
    <dc:date>2018-12-06T05:05:00Z</dc:date>
    <item>
      <title>How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509471#M5168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application handles graceful closing of the socket, but it does not recognize when the Ethernet cable has been disconnected.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my packet-handling loop, I check the result of all netconn commands used, which include:&lt;/P&gt;&lt;P&gt;netconn_recv&lt;/P&gt;&lt;P&gt;looping over netconn_data and netbuf_next to assemble a packet&lt;/P&gt;&lt;P&gt;netbuf_delete (no error check here, returns void)&lt;/P&gt;&lt;P&gt;netconn_write&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I remove the ethenet cable, the loop never exits like I would expect.&amp;nbsp; Outside the loop is where I call netconn_close and netconn_delete.&amp;nbsp; Because the loop doesn't exit, I cannot reconnect to my device after plugging the cable back in.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't get any MQX task data when I pause execution, but at one time I did see that the lwIP tcpip_task was blocked on a semaphore.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone suggest ways that I should be handling cable disconnections in lwIP?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 16:14:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509471#M5168</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-28T16:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509472#M5169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so it looks like this is the missing link:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14591823770863894 jive_macro_code jive_text_macro" data-renderedposition="60_8_1192_160" jivemacro_uid="_14591823770863894"&gt;&lt;P&gt;/**&lt;/P&gt;&lt;P&gt;* Called by a driver when its link goes down&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;void netif_set_link_down(struct netif *netif )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (netif-&amp;gt;flags &amp;amp; NETIF_FLAG_LINK_UP) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif-&amp;gt;flags &amp;amp;= ~NETIF_FLAG_LINK_UP;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NETIF_LINK_CALLBACK(netif);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like I have to call netif_set_link_callback and pass it a callback function to call when the cable is disconnected.&amp;nbsp; However, my next question is, if tcpip_task is blocked on a semaphore and I can't figure out what semaphore that is, how can I write a callback function that will allow my packet handling loop to exit gracefully and then accept a new connection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT -- I added the callback and passed it to netif_set_link_callback.&amp;nbsp; I also enabled the callback via LWIP_NETIF_LINK_CALLBACK.&amp;nbsp; Unfortunately, when I removed the cable, my callback function didn't get called.&amp;nbsp; Am I missing something else here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 16:34:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509472#M5169</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-28T16:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509473#M5170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I do not think the Ethernet controller module provides the information such as if the cable is plugged in or not. All the connection information are provided by PHY. For example, for the PHY KSZ8081, register value in address 0x1D provide the cable connection inf.&lt;/P&gt;&lt;P&gt;Pls refer to page 35 in the attached data sheet of PHY. You can get the inf by accessing PHY by the MDIO interface.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 06:59:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509473#M5170</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-03-30T06:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509474#M5171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Xiangjun.&amp;nbsp; Do you have any information on how to perform MDIO interface calls?&amp;nbsp; Is there support for this in KSDK 1.2?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 17:40:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509474#M5171</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-30T17:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509475#M5172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;You are on the right track.&lt;/P&gt;&lt;P&gt;I did a test using the lwip_ping_bm_frdmk64f example in KSDK_v2 using KDS_3.2.&lt;/P&gt;&lt;P&gt;The packet sent in this example finally ends up in ethernetif.c low_level_output() function.&amp;nbsp; I made the following edits using #if 1's:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14593637031045481" data-renderedposition="112_8_1153_272" jivemacro_uid="_14593637031045481"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Send a multicast frame when the PHY is link up. */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (kStatus_Success == PHY_GetLinkStatus(ENET, phyAddr, &amp;amp;link))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (link)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;#if 1 //DES 1=test, 0=default code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_set_link_up(&amp;amp;fsl_netif0);&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (kStatus_Success == ENET_SendFrame(ENET, &amp;amp;g_handle, pucBuffer, packetBuffer-&amp;gt;tot_len - ETH_PAD_SIZE))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ERR_OK;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;#if 1 //DES 1=test, 0=default code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_set_link_down(&amp;amp;fsl_netif0);&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;My callback blinks the Blue LED fast when connected, and slow when disconnected.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_14593640518833158 jive_macro_code jive_text_macro" data-renderedposition="410_8_1153_352" jivemacro_uid="_14593640518833158"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if 1 //DES 1=test, 0=default code&lt;/P&gt;&lt;P&gt;void delay(uint32_t loop_cnt, uint32_t blinks)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t i,j;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(j=0;j&amp;lt;blinks*2;j++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; LED_BLUE_TOGGLE(); //DES blink&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(i=0;i&amp;lt;loop_cnt;i++) //DES delay&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; __asm("nop");&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void my_link_callback(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(netif_is_link_up(&amp;amp;fsl_netif0)) { //DES link up blink fast&lt;/P&gt;&lt;P&gt;&amp;nbsp; delay(1000000U, 8U);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; else { //DES link down blink slow&lt;/P&gt;&lt;P&gt;&amp;nbsp; delay(4000000U, 8U);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;/PRE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main() had following:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14593638212996709 jive_text_macro" data-renderedposition="849_8_1153_144" jivemacro_uid="_14593638212996709"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_set_default(&amp;amp;fsl_netif0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_set_up(&amp;amp;fsl_netif0);&lt;/P&gt;&lt;P&gt;#if 1 //DES 1=test, 0=default code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_is_link_up(&amp;amp;fsl_netif0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; netif_set_link_callback(&amp;amp;fsl_netif0, my_link_callback); //DES called when link transitions&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LWIP_PLATFORM_DIAG(("\r\n************************************************"));&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;And I added PCR initialization to pin_mux.c BOARD_InitPins():&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14593638702728735" data-renderedposition="1019_8_1153_144" jivemacro_uid="_14593638702728735"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOCK_EnableClock(kCLOCK_PortB);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Affects PORTB_PCR16 register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinMux(PORTB, 16u, kPORT_MuxAlt3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Affects PORTB_PCR17 register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinMux(PORTB, 17u, kPORT_MuxAlt3);&lt;/P&gt;&lt;P&gt;#if 1 //DES 1=test, 0=default code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Led pin mux Configuration */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinMux(PORTB, 21U, kPORT_MuxAsGpio); //DES Blue LED on PTB21&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 18:51:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509475#M5172</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2016-03-30T18:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509476#M5173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The fsl_phy_driver.c provides the function to write/read phy, for example&lt;/P&gt;&lt;P&gt;enet_status_t PHY_DRV_Write(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t data);&lt;/P&gt;&lt;P&gt;enet_status_t PHY_DRV_Read(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t *dataPtr);&lt;/P&gt;&lt;P&gt;Note I refer to the example located at:&lt;/P&gt;&lt;P&gt;D:\Freescale\KSDK_1.3.0\examples\frdmk64f\demo_apps\lwip\lwip_httpserver_demo\httpserver_rtos\httpserver_mqx&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 08:45:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509476#M5173</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-03-31T08:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509477#M5174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help!&amp;nbsp; I will give this a try today and will let everyone know how it goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 12:59:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509477#M5174</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-31T12:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509478#M5175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bummer... looks like this solution won't work with KSDK 1.2.&amp;nbsp; I cannot move to KSDK 2.0 yet.&amp;nbsp; If you have any suggestions that might work in a similar manner for KSDK 1.2, please let me know!&amp;nbsp; I'll start digging around for clues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:56:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509478#M5175</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-31T14:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509479#M5176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this might be a potential start of a solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ethernetif.c, low_level_init():&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14594372873197635 jive_text_macro" data-renderedposition="86_8_1192_64" jivemacro_uid="_14594372873197635"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = PHY_DRV_GetLinkStatus(devNumber,enetIfPtr-&amp;gt;phyAddr,&amp;amp;linkstatus);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(result == kStatus_ENET_Success)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(linkstatus == true)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I wonder if it's safe for me to call the PHY_* functions from a MQX task?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 15:18:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509479#M5176</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-03-31T15:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509480#M5177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, even if I am able to detect the problem, I'm not sure yet what to do with it.&amp;nbsp; The main issue is really that the lwip tcpip_thread remains blocked if I pull the Ethernet cable.&amp;nbsp; This prevents me from reconnecting to my device.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;IMG alt="pastedImage_3.png" src="https://community.nxp.com/t5/image/serverpage/image-id/26656iE497DC324756605F/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In tcpip_thread, this looks like the only place it could be held up:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;IMG alt="pastedImage_4.png" src="https://community.nxp.com/t5/image/serverpage/image-id/26620i5883813C90E6A32C/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Here's what I have found -- when the cable is disconnected, sys_arch_mbox_fetch returns SYS_ARCH_TIMEOUT, which calls a handler and then jumps to a label called "again".&amp;nbsp; This is what is causing the tcpip_thread to look like it's blocked on a semaphore in the TAD view -- because the cable is disconnected, there isn't any data to get from the mbox, and the code just loops back and tries again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a massive hack that seems to get things going in the right direction.&amp;nbsp; I replaced the "goto again" in sys_timeouts_mbox_fetch to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14594430967197360 jive_text_macro" data-renderedposition="597_8_1192_64" jivemacro_uid="_14594430967197360"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( attempts++ &amp;lt; 10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto again;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What this does is allow the function to return after the timeout functions (tcpip, arp, dhcp, etc) timeout a certain number of times.&amp;nbsp; It's clunky, but seems to work.&amp;nbsp; The return statement will result in the caller detecting an invalid message, which is logged and ignored, which I think will work for me.&amp;nbsp; One issue with this solution that bothers me is the 10 attempts.&amp;nbsp; I selected that because there are cases where we do need retry pulling data from the mbox even when the cable is connected.&amp;nbsp; So 10 is basically just the threshold where I seem to have reliable network communications, but can also recognize a disconnected cable and recover in a timely manner when the cable is eventually reconnected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, there must be a better way to deal with disconnections than this.&amp;nbsp; I'll keep working on a better solution, but if you have any ideas, please let me know!&amp;nbsp; Thanks, &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/DavidS" rel="noopener noreferrer" target="_blank"&gt;DavidS&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:29:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509480#M5177</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2020-11-02T13:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509481#M5178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt; In my application, if the cable is pulled, then the Ethernet apps have nothing to talk to, so no packets are sent or received. When the cable is re-inserted, I do a System reset.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Startup:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cableStatus=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enet_main();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PHY_DRV_Read(0, enetIfPtr-&amp;gt;phyAddr, kEnetPhySR, &amp;amp;phyStatus);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( (phyStatus &amp;amp; 0x04) == 0x04)cableStatus=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If link up, then cable is attached.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;while(1){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PHY_DRV_Read(0, enetIfPtr-&amp;gt;phyAddr, kEnetPhySR, &amp;amp;phyStatus);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( ((phyStatus &amp;amp; 0x04) == 0) &amp;amp;&amp;amp; (cableStatus==1) ){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Ethernet cable removed.\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cableStatus=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( ((phyStatus &amp;amp; 0x04) == 0x04) &amp;amp;&amp;amp; (cableStatus==0) ){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Here when Ethernet cable inserted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_SystemReset();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 17:13:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509481#M5178</guid>
      <dc:creator>benmccormick</dc:creator>
      <dc:date>2016-04-04T17:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509482#M5179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/benmccormick"&gt;benmccormick&lt;/A&gt;​!&amp;nbsp; I'll give those functions a try to see how I can make it work in my application.&amp;nbsp; Resetting the firmware isn't an option, but I should be able to figure something out.&amp;nbsp; My original post that has the hack in it to prevent the tcpip_thread from tight looping is flawed, so I needed something else.&amp;nbsp; I'll share my approach with everyone once I get it working correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 14:13:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509482#M5179</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-04-05T14:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509483#M5180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/benmccormick"&gt;benmccormick&lt;/A&gt;​ I started to look into your solution that uses PHY_DRV_Read().&amp;nbsp; What I am seeing is that my PHY status is always 0x7849, whether my ethernet cable is connected or not.&amp;nbsp; However, I think that got me to dig some more and I ended up in low_level_init() in ethernetif.c -- in there, the library uses PHY_DRV_GetLinkStatus to determine whether or not there is a link with the client, which I think I'll be able to use now.&amp;nbsp; I'll keep updating this post with my progress.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Apr 2016 14:25:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509483#M5180</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-04-22T14:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509484#M5181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dave408"&gt;dave408&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;did you succeed? I'm having the same problem as you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be apreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gustavo Costa,&lt;/P&gt;&lt;P&gt;R&amp;amp;D Engineer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2017 01:06:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509484#M5181</guid>
      <dc:creator>gustavocosta</dc:creator>
      <dc:date>2017-10-11T01:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509485#M5182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;dave408, did you sucess???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 07:24:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509485#M5182</guid>
      <dc:creator>n_2t</dc:creator>
      <dc:date>2018-11-14T07:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509486#M5183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/thinhnguyen"&gt;thinhnguyen&lt;/A&gt;‌ It has been a long time since I worked on that project, and honestly, I cannot remember if I personally solved that problem.&amp;nbsp; It's possible that one of my colleagues that took over did figure out how to handle disconnections.&amp;nbsp; I'll ask him.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 15:21:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509486#M5183</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2018-11-14T15:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509487#M5184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave did you ask him?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to use&amp;nbsp;PHY_DRV_GetLinkStatus but linkstatus always return false, so it did not work for me.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;bool PHY_Get_Initialized_LinkStatus() {
// return true;
 if (!g_initialized) return false;
 bool linkstatus = false;
 int timeout = 10;
 uint32_t result;
 int count = 0;
 while ((count &amp;lt; timeout) &amp;amp;&amp;amp; (!linkstatus)) {
 result = PHY_DRV_GetLinkStatus(g_devNumber,g_enetIfPtr-&amp;gt;phyAddr,&amp;amp;linkstatus);
// if (result == kStatus_ENET_Success) {
// PRINTF("result == kStatus_ENET_Success, linkStatus = %d\r\n", linkstatus);
// return (linkstatus);
// } else {
// PRINTF("result == kStatus_ENET_Failed\r\n");
// return false;
// }
 count++;
 }
 if (count == timeout)
 {
 return false;
 } else {
 return true;
 }
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2018 05:05:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509487#M5184</guid>
      <dc:creator>n_2t</dc:creator>
      <dc:date>2018-12-06T05:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509488#M5185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I have the same problem but not the solution that work right.&lt;/P&gt;&lt;P&gt;Any suggestion from NXP team ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2019 11:59:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509488#M5185</guid>
      <dc:creator>mpazzi</dc:creator>
      <dc:date>2019-10-16T11:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509489#M5186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Hi everyone,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;I have the same problem but not the solution that work right.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Any suggestion from NXP team ?&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Thanks so much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2019 14:11:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509489#M5186</guid>
      <dc:creator>mpazzi</dc:creator>
      <dc:date>2019-10-18T14:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you detect (and handle!) a lwIP disconnection?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509490#M5187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm using SDK version 2.6 for a K66 processor on a proprietary hardware, and the latest release of the mcuxpresso. We use freeRTOS, lwip and web sockets. Communication works in principle, but with the mentioned hurdles regarding the connect and disconnect of the ethernet cable.&lt;/P&gt;&lt;P&gt;It seems there is no applicable solution for that item, at least for the moment. I have investigated the item in several steps, and have also changed the library code in that it gets multitasking capabilites.&lt;/P&gt;&lt;P&gt;It was mentioned by the NXP support earlier that in SDK Version 2.6 a cable connect / disconnect would be properly handled, but in fact that is not the case in 2.6 lwip. The only thing that behaves better than before is the initial connect status of the network, i.e. if no cable is connected initially and you plug in the ethernet, the system does this connect properly, and as long as there is no task with lower priority than the "communication task" that initiates the ethernet handling, that is OK. That means the system is blocked in parts in the "communication task" in several loops as long as we don't have a connection available. That is not favourable in a multitasking system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After all the changes and additions I made I am able to connect and disconnect, but sometimes the cleanup of the lwip system fails in that sense, that the slowtimer hangs in an assert after disconnecting (the pcb that is is still in the list of pcbs for the timer has state "CLOSED" whereas a "TIME_WAIT" is required). The question is now, how (and also where in the lwip library) to handle the disconnect and with it the cleanup properly. Is it possible to modify the slowtimer such that it accepts a CLOSED-state pcb?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2019 12:28:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/How-do-you-detect-and-handle-a-lwIP-disconnection/m-p/509490#M5187</guid>
      <dc:creator>haraldadolph</dc:creator>
      <dc:date>2019-10-24T12:28:17Z</dc:date>
    </item>
  </channel>
</rss>

