Skip to main content
mrniknejad
Associate II
September 30, 2011
Question

Stm32F2 : Ethernet start up infinite Loop

  • September 30, 2011
  • 11 replies
  • 2496 views
Posted on September 30, 2011 at 20:33

Hi

I have a problem in Ethernet start up using LWIP.

the program always stick in a infinite loop in below line :

while (ETH_GetSoftwareResetStatus () == SET)

what is problem and what is this line means ?

i use an external 50Mhz oscillator

( RMII Mode )

instead of using Port A.8  for

DP83848

clock source ! can this cause the problem ?

thanks

#mainwaring
    This topic has been closed for replies.

    11 replies

    Andrew Neil
    Super User
    October 1, 2011
    Posted on October 01, 2011 at 10:40

    while( ETH_GetSoftwareResetStatus() == SET )

    ''what is this line means?''

     

    That is a very basic 'C' construct! If you really don't know what it means, then you need to spend some time to update your 'C' skills!

    In 'C', a

    while

    loop will continue until the condition becomes 'true' - in the above example, the loop will continue until the value returned by 

    ETH_GetSoftwareResetStatus()

    is equal to

    SET

    ''what is problem''

     

    From understanding what the loop does (see above) it should be obvious that, if the loop never exits, then

    ETH_GetSoftwareResetStatus()

    is never returning a value equal to

    SET

    !

    You must study the documentation for

    ETH_GetSoftwareResetStatus()

    to find what conditions are necessary for it to return a value equal to

    SET

    You could also examine the source code.

    You could also investigate using the debugger.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    mrniknejad
    Associate II
    October 1, 2011
    Posted on October 01, 2011 at 21:49

    Hi

    i think you are kidding with me ! of course i know about the C construct.

    my question is when this flag toggles and why ?

    regards

    Andrew Neil
    Super User
    October 1, 2011
    Posted on October 01, 2011 at 23:27

    ''of course i know about the C construct''

    So why did you ask what it means?

    ''my question is when this flag toggles and why ?''

     

     

    What does the function's documentation say?

    Have you used the debugger to find out?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    mrniknejad
    Associate II
    October 1, 2011
    Posted on October 01, 2011 at 23:48

    hi again and thanks for your quick reply

    this line is in the ( stm32f2x7_eth_lwip ) library and the only things that i find for this line is below comment :

    Checks whether the ETHERNET software reset bit is set or not.

    debugger shows that this function always return SET and program stick in this line !

    so i don't know what is the software reset

    Andrew Neil
    Super User
    October 2, 2011
    Posted on October 02, 2011 at 09:07

    ''debugger shows that this function always return SET''

     

     

    So look inside the function - and see what causes it to return that value!

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    amin23
    Visitor II
    October 10, 2011
    Posted on October 10, 2011 at 12:27

    Hi,

    - Remove jumper JP5

    - Remove the following lines from the code:

    /* Output PLL clock divided by 2 (50MHz) on MCO pin (PA8) to clock the PHY */

      RCC_MCO1Config(RCC_MCO1Source_PLLCLK, RCC_MCO1Div_2);

     and try again

    infoinfo980
    Associate II
    October 10, 2011
    Posted on October 10, 2011 at 21:41

    ''in the above example, the loop will continue until the value returned by 

    ETH_GetSoftwareResetStatus()

    is equal to

    SET''

    A slightly important typo there Neil  :)
    Andrew Neil
    Super User
    October 10, 2011
    Posted on October 11, 2011 at 01:03

    I wondered who'd be the first to spot that...

    ;)
    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    bmcfarland
    Visitor II
    October 19, 2011
    Posted on October 19, 2011 at 21:23

    Did you ever figure out an answer to this?  I'm trying to bring up the LwIP demo on a custom built STM32F107 board and I'm stuck in the same place.   However, I am using MII mode w/ the 25 MHz output on PA8.  

    From what I understand, the SR bit should clear itself eventually if the necessary clocks are all enabled.   Obviously the next step is to delve further into the manual, errata, and the stm32_eth.c library.  However any hints to point in the right direction would be helpful.

    gustavo239955
    Associate
    December 7, 2011
    Posted on December 07, 2011 at 17:11

    People here could help others, instead of loosing everybody time with useless posts.

    I had the same problem, solved enabling the Ethernet clocks only AFTER while(ETH_GetSoftwareResetStatus()==SET).

    Why? Read the STM32F107 Manual (TRM) page 949 item 29.4.4.

    Best regards

    GUGA