cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery Ethernet

najeeeb
Associate
Posted on November 17, 2011 at 13:13

hello friends

Can any body guide me on how can i use the ethernet module of stm32f407 on discovery kit? do i need something extra?

#stm32f4-discovery #ethernet #lwip
20 REPLIES 20
kcimenci
Associate
Posted on January 23, 2013 at 10:50

hi vaidas,

i have the same problem with you, in the debug mode the system enters the infinite ''while'' loop for packet handling but ETH_CheckFrameReceived() never returns 1 and packets are not handled. But i couldn't even get the webpage from browser, or couldn't get response to pings on the startup. I make the changes on lwip stack accordingly to the posts above, is there any other configuration or changes on the code? help please.. thanks in advance

markmark9124
Associate
Posted on February 09, 2013 at 17:56

Hi,

I now spent many hours trying to compile the example code for the STM32F4 discovery following the instructions of this forum-thread.

Unfortunately I do not get it running. 

I compile the code with GCC and used the ST example (tcpechoserver) and modified it following the instructions above. 

The code compiles, but according GDB-debug my board also enters the infinite loop in the HardFaultHandler.

Does anbody have any ideas, what can be wrong?

Thanks!

Regards

Florian

Posted on February 09, 2013 at 18:07

Does anbody have any ideas, what can be wrong?

 

You don't have the IRQ handler set up right, or you're touching some memory inappropriately?

Why don't you use the debugger to determine the faulting instruction and processor registers at the time? The hard fault stacks the processor state. Put in a proper fault handler if you have to, or dig through the stack. If you know what faulted you'll be half way to solving the issue.

It could also be the while() loop is the general dumping ground for unhandled interrupt vectors.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vaidas
Associate II
Posted on February 17, 2013 at 10:24

NOTE: edited by moderator on Oct 6th, 2016

Hi Kadir,

As I'm using my own made pcb with ethernet, I recomend You, to check pinout (I've attached my schematic and few more files) of your circuit and make wires as short as possible. Did You check this out?:

[[this link/image has been flagged as malicious by our security scan software and has been deleted]]

First try to use http example, because it's the easiest way to find out that everything works fine. I'm using KEIL MDK-ARM , but it doesn't matter at all, example should work with all compilers and IDEs. I have attached part of my schematic and few files from my working example.

1) First of all(in main.c), I've reinitialized systik(it is done before main at startup, but still did it, just to be sure) and hold DP83848 reset pin low, then high and waited for a while, because it takes about 80ms to start up-maby this is not needed, but I left this part in my code...

2) Then (in main.h) I've changed board's IP address, that it appear in the same subnet as my PC(0.x, but different from my PC's IP), otherwise I should change my PC address every time I want to connect to board. And defined RMII mode.

3) In STM32f4x7_eth_bsp file changed everything as is in my board, by the example.

4) Changed HSE(external oscillator value to my Quartz value), I'm using 8MHz, this should be done in compiler's define list. If You don't know where this appears, You can just go to your project's directory and then to -> Libraries\CMSIS\Device\ST\STM32F4xx\Include, find file, named ''stm32f4xx.h'' , make ir writable(take off mark from: read only) and change the value of -> #define HSE_VALUE ((uint32_t)8000000).

5) Go to system_stm32f4xx.c file and change PLL_M value to your quartz value, mine looks like this: #define PLL_M 8.

I guess this is it about how I made my board work.

And somewhere I saw post about HardFaultHandler, mostly, this is due to uninitialized pointers. If You'll be using pointers or arrays, when You create it, you better point it somewhere, and do not leave blank... and if You don't use them, better comment.

Good luck.

Vaidas

________________

Attachments :

ethernet_example.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hz2A&d=%2Fa%2F0X0000000bQ0%2FyuRkirbz9P1wpVQYUukxMw0RwqIwTahZyLYYd6Cdrjg&asPdf=false
dannym
Associate II
Posted on February 21, 2013 at 02:30

I'd recommend the Waveshare ''motherboard'' now.  It IS a bit more pricey, but worth it IMHO.  IF you get a motherboard, they send you a DVD with working demo code of every single peripheral.  The ethernet phy module you have is PROBABLY the one that was intended to plug into the Waveshare board.  Waveshare's motherboard is entirely straight-wire to peripheral headers, there's no hard-wired hardware conflicts like this and the stuff plugs right into the connections the code example uses.  If you get the 144 pin STM32 packages then there's probably no pin conflicts in hooking up all the stuff at once.

The Waveshare stuff is at 

http://www.wvshare.com/

 but they sell under 2 names on eBay for slightly cheaper.  

These boards don't feature an ST-Link, at least mine doesn't seem to.  AFAIK the USB on the ''core board'' is just attached to the low-speed USB peripheral.  So you'll need a Segger J-Link, ULink2, or ST-Link to use is.  You can just use the header off you STM32 Discovery board, EXCEPT that pulling the two jumpers will allow you to program and debug but not receive ITM printf/getc from the SWO pin- to get that to work, you'll need to clear solder bridge SB12 on the STM32F4 Discovery board.
dannym
Associate II
Posted on February 21, 2013 at 02:30

delete

M0NKA
Senior
Posted on February 21, 2013 at 14:12

It is nice to have a good quality development board, but it can be made to work on much worse conditions, here my original alpha prototype:

http://www.flickr.com/photos/80797729%40N04/8209914083/in/photostream/lightbox/

The old version of lwIP seems to work fine, the port of ST is well done. The main problems in my view are little stuff like:

- software reset routines wrong(need some read of old topics in this forum)

- too many while(1)'s that stall the code

- hardware reset for the PHY missing, it is a must and need to be separate from the board reset(will take extra GPIO)

- PHY address scanning is needed, before attempt to talk to the PHY

So far i have small web server running, RTC calibration via NTP protocol and small http client. It was a struggle to make it work, but now works almost flawlessly.

Regards
angel
Associate
Posted on May 13, 2013 at 23:30

Hi Monka,

I am working on an STM32F407 project for which I will need NTP or SNTP.  Is it possible that you could share your experiences and code?

Regards,  Angel

Posted on May 14, 2013 at 01:29

Getting NTP time stamp packets can be done fairly easily, what are you trying to achieve? Does your board have LSE and HSE crystals?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 15, 2017 at 20:13

In 2017 a suggested method would be to use an STM32F4DIS-BB board, or one of the NUCLEO-144 boards with the Ethernet built on it, the latter being significantly cheaper than the DISCO and BB

https://www.digikey.com/product-detail/en/stmicroelectronics/STM32F4DIS-BB/497-13545-ND/3878236

 

The board is a partnership between EmBest and Element14, many example codes are available.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..