cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet configuration on STM32F407 Discovery board

seagull3010
Associate
Posted on January 08, 2016 at 11:56

I want to get networking capabilities on my stm32F-Discovery board running STM32F407VG MCU. Hence  i bought the expansion board STM32F4DIS-BB  

and interfaced it with my existing board following the instructions mentioned in STM32F4DIS-BB manual and UM1713 Developing applications on STM32Cube with LwIP TCP/IP stack . Next i tried to use the STM32Cube firmware package and found that it has useful examples such as http server, tcp echo server,etc using the LwIP stack. Now for some reason i am unable to get the communication between my PC and the discovery board to work. :(

Strange since i am using the default projects provided by ST without adding any code. While here is exactly what i tried to do : 

I tried to use the TCP server example from stm32cubef4\STM32Cube_FW_F4_V1.10.0\Projects\STM324xG_EVAL\Applications\LwIP\LwIP_TCP_Echo_Server folder. I compiled it initially i was unable to it to work properly as i saw via the debugger that the code would hang at 

  /* Wait for software reset */

  while (((heth->Instance)->DMABMR & ETH_DMABMR_SR) != (uint32_t)RESET)

  {

  }

so i looked up and found the solution  on these forums . the trick was the enable the Ethernet clock after the reset so now i could see that the IP address of the board was being correctly set ( default static ip ) and that the program goes into a wait state waiting to serve request to any client that would connect to it. 

The strange problem is that I am just unable to get my PC to discover the device. I setup my PC to be in the same subnet as the discovery board. Here are my  board settings:

 

/*Static IP ADDRESS: IP_ADDR0.IP_ADDR1.IP_ADDR2.IP_ADDR3 */

&sharpdefine IP_ADDR0   192

&sharpdefine IP_ADDR1   168

&sharpdefine IP_ADDR2   0

&sharpdefine IP_ADDR3   10

   

/*NETMASK*/

&sharpdefine NETMASK_ADDR0   255

&sharpdefine NETMASK_ADDR1   255

&sharpdefine NETMASK_ADDR2   255

&sharpdefine NETMASK_ADDR3   0

/*Gateway Address*/

&sharpdefine GW_ADDR0   192

&sharpdefine GW_ADDR1   168

&sharpdefine GW_ADDR2   0

&sharpdefine GW_ADDR3   1

And my PC is set to : 

IP : 192.168.0.11

Subnet  : 255.255.255.0

Gateway : 192.168.0.1

I tried both crossover and straight Ethernet cables for connecting my board and PC. 

Also the readme.txt file inside the folder at stm32cubef4\STM32Cube_FW_F4_V1.10.0\Projects\STM324xG_EVAL\Applications\LwIP\LwIP_TCP_Echo_Server does not mention to me any additonal jumper settings that i should do ? Or do i genuinely miss something very very obvious here ?? 

The ping as well as echotool utility fail to establish connection with my board. Seems very strange that the straightforward example couldnt work ?

Any tips ?

#stm32f4discovery-stm3240g-sdio
3 REPLIES 3
Oussema Hajjem_O
Associate III
Posted on January 13, 2016 at 10:41

Hello,

Thank you for your post,

Your problem here is that you are running an application developed on STM324xG_EVAL with  a STM32F407 Discovery board.

The communication between the STM32 and the Ethernet PHY device differs between two boards. In STM324xG_EVAL MII interface is used and In your expansion board the RMII interface is used.

So first you have to change your MediaInterface parameter to  ETH_MEDIA_INTERFACE_RMII in Ethernet initialization.

Then please be sure that the Ethernet clock input is 50 MHz (must be generated by the PHY). Also you have to check your PHY address to be passed in PhyAddress parameter, this value depend on the used board.

Finally verify the PHY registers definition in the stm32f4xx_hal_conf.h file, if your PHY is different from the PHY present in the STM324xG_EVAL Board.

Best regards,

LEO.

AvaTar
Lead
Posted on January 13, 2016 at 12:37

You can download a working TCP/IP example from element14.com, a distributor of the STM32F4DIS-BB. At least one still could last year.

It is based on the ''old'' SPL libs, but works - I tried this myself about two years ago.

If you rather want to go with CubeMX - good luck ...

seagull3010
Associate
Posted on February 15, 2016 at 12:10

Thanks for the suggestions especially @Avatar.

I got the ethernet communication working for my discovery board. The trick was to use the sample codes provided by element14 ( as suggested by Avatar). I could not get the STCUBE samples working. However I am happy that the former does which is good enough for me.

Here is the link to download the samples : https://www.element14.com/community/docs/DOC-51670/l/stm32f4dis-bb-discover-more-software-examples

Also my exact version of the Discovery board is the STM32F4 discovery board with the STM32F407VGT6 MCU . 

Hope this will help someone in the future.