cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32F2 : Ethernet start up infinite Loop

mrniknejad
Associate II
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
11 REPLIES 11
Andrew Neil
Evangelist III
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.

mrniknejad
Associate II
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
Evangelist III
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?

mrniknejad
Associate II
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
Evangelist III
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!

amin23
Associate II
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
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
Evangelist III
Posted on October 11, 2011 at 01:03

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

;)
bmcfarland
Associate
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.