<?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>Kinetis Microcontrollers中的主题 Re: Autonegotiation in PHY_Init() hangs</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683023#M42037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Massimiliano Cialdi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial;"&gt;Regards your question, &lt;BR /&gt;&lt;EM&gt;I wonder why the check is done without check link state.&lt;/EM&gt; &lt;BR /&gt;&lt;BR /&gt;The value for this PHY_TIMEOUT_COUNT is a standard time to have enough time for the autonegotiation, this is why this value is this big, you could change it if you don't need it so big.&lt;BR /&gt;&lt;BR /&gt;Unfortunately MCU cannot give you the state of the connection until you have successfully initialized the stack, and as long as this part of the code is below to the initialization, you don't have a method to know this state.&lt;BR /&gt;&lt;BR /&gt;This functions should not be called until the physical connection is already set. My recommendation is that if you don't need to initialize the stack (you don't have connected ethernet cable) then you don't initialized.&lt;BR /&gt;&lt;BR /&gt;Hope this information could help you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Jul 2017 21:30:19 GMT</pubDate>
    <dc:creator>jorge_a_vazquez</dc:creator>
    <dc:date>2017-07-17T21:30:19Z</dc:date>
    <item>
      <title>Autonegotiation in PHY_Init() hangs</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683022#M42036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PHY driver provided with KSDK 2.2 has the function PHY_Init() that need to be explained:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in particular line 102:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background: #ffffff;"&gt;result = PHY_Write(base, phyAddr, PHY_BASICCONTROL_REG,
&amp;nbsp;&amp;nbsp; &amp;nbsp;(PHY_BCTL_AUTONEG_MASK | PHY_BCTL_RESTART_AUTONEG_MASK));
if (result == kStatus_Success)
{
&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Check auto negotiation complete. */
&amp;nbsp;&amp;nbsp; &amp;nbsp;while (counter --)
&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;result = PHY_Read(base, phyAddr, PHY_BASICSTATUS_REG, &amp;amp;bssReg);
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ( result == kStatus_Success)
&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 ((bssReg &amp;amp; PHY_BSTATUS_AUTONEGCOMP_MASK) != 0)
&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;break;
&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 (!counter)
&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 kStatus_PHY_AutoNegotiateFail;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the link is down (eg. ethernet cable disconnected) it loops until count is not 0. count is initialize to 1048575, so it loops for many seconds.&lt;/P&gt;&lt;P&gt;This results, in an hands of many seconds at startup.&lt;/P&gt;&lt;P&gt;I wonder why the check is done without check link state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2017 13:12:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683022#M42036</guid>
      <dc:creator>mastupristi</dc:creator>
      <dc:date>2017-07-04T13:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Autonegotiation in PHY_Init() hangs</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683023#M42037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Massimiliano Cialdi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial;"&gt;Regards your question, &lt;BR /&gt;&lt;EM&gt;I wonder why the check is done without check link state.&lt;/EM&gt; &lt;BR /&gt;&lt;BR /&gt;The value for this PHY_TIMEOUT_COUNT is a standard time to have enough time for the autonegotiation, this is why this value is this big, you could change it if you don't need it so big.&lt;BR /&gt;&lt;BR /&gt;Unfortunately MCU cannot give you the state of the connection until you have successfully initialized the stack, and as long as this part of the code is below to the initialization, you don't have a method to know this state.&lt;BR /&gt;&lt;BR /&gt;This functions should not be called until the physical connection is already set. My recommendation is that if you don't need to initialize the stack (you don't have connected ethernet cable) then you don't initialized.&lt;BR /&gt;&lt;BR /&gt;Hope this information could help you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jul 2017 21:30:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683023#M42037</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2017-07-17T21:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Autonegotiation in PHY_Init() hangs</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683024#M42038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to implement the lwIP on TWR-K64 alongside my project. When I tested&amp;nbsp;lwIP example from KSDK2.0 it worked fine, but when I port it into my own project it gets stuck in the autonegotiation part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's like the there is no cable connected, but it is...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By emulating, I could see that the PHY_Init() function always reads variable "&lt;STRONG&gt;bssReg&lt;/STRONG&gt;" as&amp;nbsp; 0, as shown in the code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background: #ffffff; border: 0px;"&gt;result = PHY_Write(base, phyAddr, PHY_BASICCONTROL_REG,
&amp;nbsp;&amp;nbsp; &amp;nbsp;(PHY_BCTL_AUTONEG_MASK | PHY_BCTL_RESTART_AUTONEG_MASK));
if (result == kStatus_Success)
{
&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Check auto negotiation complete. */
&amp;nbsp;&amp;nbsp; &amp;nbsp;while (counter --)
&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;result = PHY_Read(base, phyAddr, PHY_BASICSTATUS_REG, &amp;amp;bssReg);
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ( result == kStatus_Success)
&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 ((bssReg &amp;amp; PHY_BSTATUS_AUTONEGCOMP_MASK) != 0)
&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;break;
&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 (!counter)
&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 kStatus_PHY_AutoNegotiateFail;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my project:&amp;nbsp;&lt;A class="link-titled" href="https://www.dropbox.com/sh/ebe1e7jookkxb8u/AADpod5Thm2RcMCiOS08PYTla?dl=0" rel="nofollow noopener noreferrer" title="https://www.dropbox.com/sh/ebe1e7jookkxb8u/AADpod5Thm2RcMCiOS08PYTla?dl=0" target="_blank"&gt;Dropbox - TWR-K64&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked everywhere for a solution, but I didn't&amp;nbsp;find one. If anyone could help I'd be extremely thankful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Gustavo Costa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 13:33:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Autonegotiation-in-PHY-Init-hangs/m-p/683024#M42038</guid>
      <dc:creator>gustavocosta</dc:creator>
      <dc:date>2017-08-29T13:33:35Z</dc:date>
    </item>
  </channel>
</rss>

