Home > ARM, Development boards > Ethernet on STM32F4DISCOVERY using external PHY

Ethernet on STM32F4DISCOVERY using external PHY

August 24th, 2012 Leave a comment Go to comments

For you who have read about the STM32F4 Cortex-M4 processor you might know that this processor family includes a 10/100 Ethernet MAC with dedicated DMA that supports supports IEEE 1588v2 hardware, MII/RMII.
This means that the only electronics needed to enable the ethernet capability is an external PHY and the Magjack connector.

On the STM3240G-EVAL evaluation board the DP83848 PHY is used and luckily for us we were able to find a simple breakout board for this chip on eBay.

DP83848 Phy breakout board


To hook up this Phy to the STM32F4DISCOVERY board a slight change in the pins, compared to the connections on the evaluation board, had to be made. Because the STM32F4DISCOVERY board only contains the 100-pin version some of the full MII pins are missing so we have to use the PHY in RMII mode.

So by taking the example project files for the Webpage example on the evaluation board, changing the GPIO initialization and Ethernet BSP file a bit to match the Discovery board, we were able to get the example running on our board.
The connections between the PHY module and the STM32F4DISCOVERY board can be seen in the image below.

Ethernet PHY connections


On the PHY Breakout board there is space for a jumper. This jumper is used for external reset and should not be installed to work in this project.

To see the Ethernet functionality in use with the webpage example loaded on the Discovery board have a look at our video below.


The GCC project for the Webpage demonstration on the STM32F4DISCOVERY board, shown in the video, together with a CooCox CoIDE project file can be downloaded from the following link: STM32F4DISCOVERY Ethernet-Phy – Webpage example

Thanks to a comment from @P_K there is a very simple way to generate your own new HTML files using the “makefsdata.exe” file found inside the “STM32F4x7_ETH_LwIP_V1.0.0\Utilities\Third_Party\PC_Software” folder.
Please read more about how to do so at the following page: http://www.aimagin.com/tgr/tgr12/amgf4connect/doc/HTML/index.html?webpage_configuration.htm

A comment from @Alex provides the following list with solutions to some of the problems that you might encounter when trying to setup this project and get it working:

  1. First of all, if you are getting problems to ping your PHY, please reduce your cables to 5cm. Your freq is really high and interference is something real to kill your tests!
  2. If you’re having problems at compile, make sure that your fsdata.c is out of your project to compile. You can find this file at “Ethernet/src”.
  3. Try to use Static IP for initials tests so, comment the line with #define USE_DHCP in main.c file. It will be a lot easier if your make a direct connection to your computer form your device and watch what is happening with the connection with Wireshark.

You can eventually also see the following forum post on how to get ChibiOS and their Ethernet example to work with the setup described in this post: http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=23&p=8017#p8017

Categories: ARM, Development boards Tags:
  1. kurt
    September 6th, 2012 at 18:18 | #1

    Nice, I tried the same thing with MII interface. I made own board with ethernet (DP83848) and LCD but it didnt work. Problem can be between magjack and PHY (probably bad PCB design)… I envy you 🙂

  2. Guillaume
    September 7th, 2012 at 20:01 | #2

    Hi Thomas,

    You are using RMII, not MII. RMII is the name for reduced MII. RMII works with a 50 MHz clock rather than a 25 MHz clock for the MII mode. How do you generate this clock?

  3. September 7th, 2012 at 22:50 | #3

    @Guillaume
    Thank you for noticing. I have now changed the post.
    About the clock there is a 50MHz oscillator on the Phy board we bought on eBay. Though the board can also be clocked externally if necessary – like for full MII.

  4. P_K
    September 8th, 2012 at 16:24 | #4

    Your project not run in my PC. I use CooCox CoIDE 1.2.4, open the project and try build, but I see “BUILD FAILED A pseudo attribute name is expected.” I don’t know what is wrong. Please help me. 😉

  5. September 8th, 2012 at 16:32 | #5

    @P_K
    Please update to the latest version of CoIDE. We are using CoIDE v 1.5.0!
    Also which version of GCC are you using? We are using the GCC ARM Embedded v4.6 2012q2

  6. P_K
    September 8th, 2012 at 21:46 | #6

    When I used CoIDE v 1.5.0 and GCC ARM Embedded v4.6 2012q2 from your link, project was imported and was building, but in the end in console I saw “BUILD FAILED”. In Debug catalog was created 2 catalogs: “obj” and “bin”, but “bin” is empty and I don’t have file *.bin, *.hex …

  7. September 10th, 2012 at 17:48 | #7

    @P_K
    I have the same problem (COIDE 1.5 and GCC ARM Embedded v4.6 2012q2) !!!
    I can send You log.
    Regards

  8. September 11th, 2012 at 13:47 | #8

    @P_K
    What kind of error is it giving you in the Console?
    “Build Failed” means that the compiler (GCC) returned an error, either in the compiling or linking stage.
    So please write the exact error it is telling you.

  9. September 11th, 2012 at 13:48 | #9

    @Andy
    Please just write one of the error lines in here so I can try to track it down.
    This will then also be more usefull for other readers if they experience the same error.

  10. September 11th, 2012 at 15:58 | #10

    @Thomas Jespersen
    Hi,
    The log is very big.Plase send me e-mail .
    Last part of compilation log:

    [cc] D:CooCox141CoIDEworkspaceSTM32F4_EthernetSTM32F4x7_ETH_Driversrccoreraw.c:238:5: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘u32_t’ [-Wformat]
    [cc] D:CooCox141CoIDEworkspaceSTM32F4_EthernetSTM32F4x7_ETH_Driversrccoreraw.c:238:5: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘u32_t’ [-Wformat]
    [cc] Starting link
    [cc] arm-none-eabi-gcc -O0 -nostartfiles -Wl,-Map=STM32F4_Ethernet.map -mcpu=cortex-m4 -mthumb -LD:CooCox141CoIDEworkspaceSTM32F4_Ethernet -Wl,–gc-sections -Wl,-TD:CooCox141CoIDEworkspaceSTM32F4_Ethernetarm-gcc-link.ld -g -o STM32F4_Ethernet.elf ..objstm32f4xx_syscfg.o ..objmem.o ..objtcp.o ..objerr.o ..objrandm.o ..objmib_structs.o ..objtcp_in.o ..objstm32f4xx_usart.o ..objslipif.o ..objmemp.o ..objautoip.o ..objip_frag.o ..objmsg_out.o ..objnetbuf.o ..objtcpip.o ..objstm32f4xx_dac.o ..objasn1_dec.o ..objlcp.o ..objfsdata.o ..objvj.o ..objfs.o ..objstartup_stm32f4xx.o ..objstm32f4_discovery.o ..objstm32f4x7_eth.o ..objsys.o ..objip_addr.o ..objinet_chksum.o ..objmain.o ..objstm32f4xx_rcc.o ..objnetconf.o ..objmib2.o ..objstm32f4xx_it.o ..objnetdb.o ..objinit.o ..objstm32f4xx_adc.o ..objstm32f4x7_eth_bsp.o ..objprintf.o ..objethernetif.o ..objchpms.o ..objetharp.o ..objhttpd.o ..objmagic.o ..objhttpd_cgi_ssi.o ..objpbuf.o ..objstats.o ..objinet.o ..objmsg_in.o ..objnetif.o ..objasn1_enc.o ..objfsm.o ..objapi_msg.o ..objchap.o ..objstm32f4xx_gpio.o ..objmd5.o ..objsystem_stm32f4xx.o ..objsyscalls.o ..objsockets.o ..objigmp.o ..objpap.o ..objudp.o ..objip.o ..objauth.o ..objstm32f4xx_exti.o ..objppp_oe.o ..objicmp.o ..objdns.o ..objnetifapi.o ..objmisc.o ..objapi_lib.o ..objdhcp.o ..objppp.o ..objserial_debug.o ..objipcp.o ..objtcp_out.o ..objloopif.o ..objraw.o
    [cc] ..objfs.o:(.rodata+0x0): multiple definition of `file__STM32F4x7_files_ST_gif’
    [cc] ..objfs.o:(.rodata+0xcc3c): multiple definition of `file__STM32F4x7LED_html’
    [cc] ..objfsdata.o:(.rodata+0xcc28): first defined here
    [cc] ..objfs.o:(.rodata+0xcc28): multiple definition of `file__STM32F4x7_files_stm32_jpg’
    [cc] ..objfsdata.o:(.rodata+0xcc14): first defined here
    [cc] ..objfs.o:(.rodata+0xcc14): multiple definition of `file__STM32F4x7_files_logo_jpg’
    [cc] ..objfsdata.o:(.rodata+0x0): first defined here
    [cc] ..objfsdata.o:(.rodata+0xcc3c): first defined here
    [cc] ..objfs.o:(.rodata+0xcc50): multiple definition of `file__404_html’
    [cc] ..objfsdata.o:(.rodata+0xcc50): first defined here
    [cc] ..objfs.o:(.rodata+0xcc64): multiple definition of `file__index_html’
    [cc] ..objfsdata.o:(.rodata+0xcc64): first defined here
    [cc] ..objfs.o:(.rodata+0xcc78): multiple definition of `file__STM32F4x7ADC_shtml’
    [cc] ..objfsdata.o:(.rodata+0xcc78): first defined here
    [cc] collect2: ld returned 1 exit status

    BUILD FAILED
    Total time: 21 seconds

  11. September 11th, 2012 at 18:16 | #11

    Thank you for sending me the log.
    The last lines in the log is the most importants, as they indicate the error! The others are only warnings.

    The problem lies within the Project file as when saved, the excluded files is saved with the complete directory address (my local PC). So when downloaded to your PC to another directory/address than mine, the files that has to be excluded is no longer excluded.

    The solution to the problem is to right click at the file “fsdata.c” found in the “Ethernet/source” folder in the Project list, and then select “Exclude from Build”.

    Please let me know if it compiles then.

  12. September 11th, 2012 at 19:22 | #12

    @Thomas Jespersen
    Thanks for help.
    Warings is not problem .

    I do â??Exclude from Buildâ? for fsdata.c ,and BUILD SUCCESSFUL on CoIDE 🙂 :
    ========================================
    Program Size:
    text data bss dec hex filename
    151532 2284 34260 188076 2deac STM32F4_Ethernet.elf

    BUILD SUCCESSFUL
    Total time: 27 seconds

  13. Joerg
    September 18th, 2012 at 15:54 | #13

    How to change HTML sites ? Changes in fs Dir takes no effort.

    regards

  14. September 24th, 2012 at 18:33 | #14

    @Joerg
    No, you can’t just change the files in the fs directory.
    These files are just in there for demonstration purpose, as these files have been “cooked down” into the single “fsdata.c” file which contains the raw bytes of all the HTML content.

  15. assad
    September 29th, 2012 at 19:04 | #15

    sir can you demonstrate how yo use cmsis-dsp libraries on cortex M4

  16. September 30th, 2012 at 10:15 | #16

    @assad
    Dear Assad.
    We are actually working on getting the DSP library to work on the Cortex-M4 within the CooCox CoIDE environment (GNU GCC).
    Though to get it working it requires that you recompile the cmsis-dsp library for the GNU GCC compiler, but by using Keil uVision etc.

    We will hopefully soon make a guide about this.

  17. P_K
    September 30th, 2012 at 13:36 | #17

    How change whatever on HTML page? How “cook down” new changed page?

  18. October 1st, 2012 at 07:59 | #18

    @P_K
    Probably with a program that ST has made but not published. I don’t know.
    It seems to me that it doesn’t come with the example, so it is no simple click-and-press solution to change the pages.

  19. P_K
    October 1st, 2012 at 20:44 | #19
  20. October 2nd, 2012 at 07:47 | #20

    @P_K
    Ahh great. Thank you very much for that link.

  21. October 3rd, 2012 at 15:47 | #21

    any example stm32f4 through enc28j60 with keil mdk arm

  22. impacty
    October 4th, 2012 at 14:45 | #22

    What value should the voltage at pfbout have, if the phy works correctly? How much difference is allowed? The datasheet doesn`t give much information about it. Thx

  23. October 5th, 2012 at 06:34 | #23

    GREAT!!! You made my day! I’m just thinking about burst up of my F4 to control some equipment thru ethernet.

  24. October 8th, 2012 at 17:11 | #24

    @impacty
    I don’t know about the expected voltage of the PFBOUT pin and I haven’t tried measuring it either.
    Are you asking because you are having some troubles?

  25. October 8th, 2012 at 17:43 | #25

    @Heru
    Dear Heru.
    I don’t have any examples for Keil, but I have made an ENC28J60 test application for the STM32F4 within Atollic TrueStudio.
    That project including the ENC28J60 library can be found here: http://www.tkjelectronics.dk/uploads/STM32F4_SPI_Ethernet.zip
    Please notice that this code is not finished yet and therefor not released into the public (on our Github).

    Regards Thomas

  26. Joerg
    October 13th, 2012 at 22:14 | #26

    Hi Thomas,
    I think You are the right man for make that running. Based on the Sample from ST Dennis added SD Card and a lot of other tings to the server. But he has no Project settings.

    https://bitbucket.org/blackbird745/stm32f4-webserver/src

    I just bit out my tooth to make it work with CoIde

    regards

    Joerg

  27. October 15th, 2012 at 05:58 | #27

    helloo
    i just have a question ,i used to follow this direction http://www.aimagin.com/tgr/tgr12/amgf4connect/doc/HTML/index.html?webpage_configuration.htm
    but it didn’t work but i tried your project and i programmed your hex file and it does work , but your project file is not for keil , how can i open it? which compiler did u used?
    thank you

  28. Peti
    October 15th, 2012 at 22:59 | #28

    Hi Thomas!

    Nice work!
    I wold like to try the same with another PHY but I am really beginner and could not.
    I downloaded your CooCox CoIDE project, compiled and
    programming the stm32f4discovery succesfully. I can see the
    blinking led but the connection is not work.
    I tried with dhcp and without
    check the application from browser and from win7 cmd with ping command but there is
    no answer

    My ethernet phy is:
    http://www.mikroe.com/downloads/get/1447/eth_phy_manual_v100.pdf
    Need to modify something in your project because I use different PHY mentioned by above?

    regards

    Peti

  29. Heru
    October 20th, 2012 at 02:37 | #29

    @Thomas Jespersen
    i’ve tried http://www.tkjelectronics.dk/uploads/STM32F4_SPI_Ethernet.zip, but i give up with process of tcp fragmentation, how to handle larger web page with stateless machine, … on the otherside, many suggestion to use udp, as we knows udp is state less

  30. November 4th, 2012 at 13:20 | #30

    @Joerg
    Dear Joerg.
    Thank you for posting that link – I wasn’t aware of that source.
    Would you mind zipping up your CoIDE project to save us the hassle when testing?

    Then I will test it and if it works promising I will put it in the blog post too.
    Thanks.

    Regards Thomas

  31. November 4th, 2012 at 13:27 | #31

    @Mahan
    The project I’ve uploaded is actually a modified version of the ST released standalone httpserver – to be found in: “STM32F4x7_ETH_LwIP_V1.0.0ProjectStandalonehttpserver”.
    In this ST release there is a Keil project file which you should be able to open.

    To get the project working with the STM32F4DISCOVERY board just go grab the following two files from our project folder and put inside the ST released folder:
    – “STM32F4x7_ETH_LwIP_V1.0.0ProjectStandalonehttpserversrcstm32f4x7_eth_bsp.c” replace with “OURSEthernetsourcestm32f4x7_eth_bsp.c”
    – “STM32F4x7_ETH_LwIP_V1.0.0ProjectStandalonehttpserverincstm32f4x7_eth_bsp.h” replace with “OURSEthernetincludestm32f4x7_eth_bsp.h”

    Let me know if it works for you.

    Regards Thomas

  32. November 4th, 2012 at 13:48 | #32

    @Peti
    I see you have the LAN8720A PHY chip.
    Unfortunately I have only worked with the DP83848 and the KS8721BL so I have no experience to share with you about your PHY.

    Though thru what I have tried changing from one PHY to another shouldn’t be a difficult task as long as they work about the same (the internal registers), which most PHY’s do.
    For you to get it working you should focus on getting the right PHY address, which is actually not the PHY address itself but a bus address telling the STM32F4 device where the Ethernet PHY can be found.

    This code can be added to the bottom of the ETH_MACDMA_Config() function inside the stm32f4x7_eth_bsp.c to check for a valid LAN8720A PHY.

      unsigned int PhyAddr;
        union {
          uint32_t    HI_LO;
          struct
          {
            uint16_t  LO;
            uint16_t  HI;
          };
        } PHYID;
      for(PhyAddr = 1; 32 >= PhyAddr; PhyAddr++)
      {


        // datasheet for the LAN8720A ethernet controller (http://www.smsc.com/media/Downloads_Public/Data_Sheets/8720a.pdf)
        // page 51-52 --> PHY Identifier Register 1 and 2
        PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2);  // 0x0007
        PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3);  // Mixed bits
        if (0x0007 == PHYID.HI) break;
      }

      if(32 < PhyAddr)
      {
        //printf("Ethernet Phy Not Foundnr");
        while (1);
      }


      BOARD_PHY_ADDRESS = PhyAddr;

      /* Configure Ethernet */
      EthInitStatus = ETH_Init(&ETH_InitStructure, BOARD_PHY_ADDRESS);

    Good luck.

    Best Regards
    Thomas Jespersen

  33. DeusExMachina
    December 6th, 2012 at 02:11 | #33

    I’ve made everything according connection scheme with the same PHY board and flashed my Discovery with your hex file from archive, but I can’t get connection (only orange led is blinking first time). In connection properties where are send packets, but no received packets. What can be wrong? I also installed Wireshark, and found only packets send by computer, not Discovery. Connection is established only if static IP is selected.

  34. DeusExMachina
    December 8th, 2012 at 23:20 | #34

    @DeusExMachina
    everything is ok, it was too long wires

  35. vaidas
    December 29th, 2012 at 12:01 | #35

    Hi,
    I’m new in STM microcontrollers and I would like to ask if someone had similar problem with ethernet and LwIP stack: I simply took first example in LwIP (httpserver) and got problem->after some code corrections as mentioned above, when I compile and start debugging, everything works fine, I can open my own made page (made by using fsdata) on browser and etc., but after microcontroller reset ETH_CheckFrameReceived() never returns 1 and packets are not handled…Any ideas? Thx.

  36. vaidas
    December 29th, 2012 at 15:57 | #36

    Oh, it was my mistake, I didn’t imagine how long could take DP83848 startup… the main problem was that stm32f407 starts mush faster and tries to initialize DP83848 while it’s not ready…small delay helped.

  37. December 30th, 2012 at 00:14 | #37

    @vaidas
    When resetting the microprocessor did you reset the DP83848 chip too by its’ reset pin?
    If so, then yes, you will have to wait a couple of hundred milliseconds for it to restart.

    But thank you for the information if we or any other run into similar issues.

  38. vaidas
    December 30th, 2012 at 09:23 | #38

    @Thomas Jespersen
    Yes, I was reseting DP83848 by reset pin, but at first didn’t put any delay after that (somehow I imagined that stm32f407 startup time is set to much longer), it’s just because this is my first STM microcontroller. It was very confusing, because I’ve made my own PCB and didn’t have hardware reset button on my board, that’s why I spent few hours for debugging this problem(after downloading program to flash, everything worked, but after turning off the board, it didn’t)… and just then I read full DP83848 datasheet and put delay…

  39. Gabor
    December 31st, 2012 at 16:25 | #39

    Dear Thomas,

    I have downloaded your project, and upload via CoIDE, but it can’t work. If I use DHCP mode, I get four “DHCP offer” messages at wireshark. So I think, Discovery board can send “DHCP Discover” to network.

    If i don’t use DHCP, I get “02:00:00:00:00:01 Broadcast ARP 60 Gratuitous ARP for 192.168.0.111 (Request)” at wireshark.

    So it can send message to network, but it can’t receive, I think… I am using 3 meters UTP cabel for connection, and ~10-15 cm wires to Discovery board.

    Happy new year, and best wishes!

  40. Gabor
    December 31st, 2012 at 16:49 | #40

    @DeusExMachina
    What wires were too long? Between router and DP83848, or between Discovery board and DP83848? I am getting, what you get.. Board can send messages, but can’t receive 🙁

  41. vaidas
    January 2nd, 2013 at 00:29 | #41

    @Gabor
    I guess(99%), that wires between Discovery board and DP83848, because internet cable can be 150 meters long with no errors. I don’t know, but I guess again, that if your wires between Discovery board and DP83848 board are long enough (~10cm) there could appear problems due to signal interference in neighbour wires and also appears significant capacity between wires and wire inductance…If u use discovery board, that means u use RMII interface, which is clocked by 50MHz, so clock’s period is T=1/50*10^6=20ns.

  42. Gabor
    January 2nd, 2013 at 17:27 | #42

    @vaidas
    Thank you for your answer. So, what do I have to do? Do I have to use shorter wires, and that’s enough? In youtube video, which has been linked by Thomas to this site, looks like he uses “long” wires, and no problem.

  43. vaidas
    January 2nd, 2013 at 20:39 | #43

    @Gabor
    Yes, these wires are long enough… but I would make them as short as possible, but maby problem is in different place…
    I’ve just read your older post and you say that : “Board can send messages, but canâ??t receive”. How do u know, that board can send message? u told something about wireshark. Did u decide, that your board is alive from wireshark? Blinking led means that something is on the wire and doesn’t say which direction.I was compiling this project with MDK-ARM, but I think it’s everything the same. When I was debugging my ethernet hardware, I turned off DHCP by commenting define statement (USE_DHCP or similar), changed IP address into local’s network, for example 192.168.0.15, then manually configured my LAN card’s parameters to the same network, for example 192.168.0.12 and pinged my device with RUN-> CMD -> ping 192.168.0.15 . Another solution-> it’s known that web server uses TCP protocol and 80 port to communicate with your board. Even if you are not asking to download web application in your browser, your computer and Discovery board comunicates, when you just plug the cable(between board and computer)- it’s 3 steps handshake and if you will turn off your internet and filter packets in wireshark, u will see what is going on on the line. What I want to say is- maby everything is working, but u want to check communication in wrong methods.
    Good Luck, keep working.

  44. vaidas
    January 2nd, 2013 at 20:57 | #44

    @Gabor
    oh, and one more thing, u wrote, that ARP works on your board and your IP is 192.168.0.111, so everything works, that means, that your computer asks your board and it answers. If I misunderstood something in your post, just type in CMD: “arp -a”, and it shows all devices connected to your LAN cards (including wireless and virtual), if in one of lines you will find your mac :”02:00:00:00:00:01″ with IP, that definitely means that everything is OK with your card. And if u just don’t see that webserver on internet browser, check folder “ProjectStandalonehttpserverfs” if there is index.html file, maby you are compiling empty webserver page. Or your LAN and board is in different subnet…

  45. Gabor
    January 2nd, 2013 at 21:51 | #45

    @vaidas
    “How do u know, that board can send message?” If I use DHCP mode, I get “DHCP Offer” from my router in wireshark.
    According to DHCP protocol, 1) client send “DHCP Discover” to broadcast, and somebody will answer. So 2) my router answer “DHCP Offer”, but it repeats four times, because nobody (client) send answer, “DHCP request”.

    I think, board can send messages, like “DHCP Discover”, but can’t receive, because it isn’t answer to router’s “DHCP Offer” message.

    I tried to get devices with “arp -a” command, but I didn’t found board’s MAC address. Board just send “arp gratuitous” to broadcast.

    I switched to fixed IP, like 192.168.0.111, and opened in webbrowser. I get ping timeout.

  46. vaidas
    January 2nd, 2013 at 22:28 | #46

    @Gabor
    hmmm…very interesting…
    1) do you see one led always on(when plug cable) and another blinking? if yes, that means your PHY chip is in normal mode, if not, it’s in reset state.
    2) for arp’ing I recommend to use straight cable to your PC, without router, and configure manually your LAN card with something 192.168.0.100. Maby your PC and board are in different subnets, then ARP cannot find your board.
    3) need to check wires, maby some mistake…

  47. Gabor
    January 3rd, 2013 at 00:57 | #47

    @vaidas
    I made quickly a crossover cabel. Aaaand it works without router :), but sometimes throw ping timeout. I think, I have to optimize wires between board and ethernet module, and it will be better.
    Thank you so much, best wishes!

  48. Vaidas
    January 3rd, 2013 at 07:22 | #48

    @Gabor
    And one more thing – you don’t need to change cable, auto-MDIX should handle this, because if DP83848 feels that something is wrong with cabling, it changes Rx logic with Tx logic and u don’t need to change cable(PC side or new routers acts the same way). And if you want to use your router, u have to change subnet in your board.
    Yes, timeouts can appear because of long cables, if due to wires capacity and resistance (T=RC) some bits dissapear, when board checks CRC it doesn’t match and it throw packet to the trash bin… try to ping it in CMD and check how many percent of packages reach destination.
    Glad could help.
    Good luck in your future projects.

  49. P_K
    January 9th, 2013 at 18:39 | #49

    My ping from PC to STM is to high and is nearly 130ms. How to decrease this value?

  50. January 9th, 2013 at 21:33 | #50

    @P_K
    We are experiencing the same same issue – both with the Discovery board and the DP83848 Phy, but also with the Olimex board and the KS8721BLMM Phy.
    I think it might have something to do with either the lwIP stack, the configuration of it or an issue with the NVIC interrupt processing on the STM32 processor.

    The issue is still to be resolved!

  51. Tobias
    January 24th, 2013 at 12:43 | #51

    Hi,

    I try to compile the projekt with CoIDE 1.7.0. But there is no option to “Exclude from Build” the fsdata.c

    Is there a otherway to compile the projekt?

    Thanks for your help.

  52. Kadir Cimenci
    January 25th, 2013 at 09:05 | #52

    125 39.520406000 0.0.0.0 255.255.255.255 DHCP 350 DHCP Discover – Transaction ID 0xabcd0001
    72 14.522511000 192.168.2.20 239.255.255.250 UDP 1035 Source port: 52609 Destination port: ws-discovery

    hi everyone,

    im using stm32f4 discovery board and dp83848 as phy module. The changes i have made on the lwip example of st(standalone->httpserver example)

    1) gpio alternative function definitions and initializations for PA1,PA2,PA7,PC4,PC5,PC1,PB11,PB12,PB13
    2) Definition of HSE value as 8000000hz and pll_m value as 8
    3) Moving the MCO pin (PA8) initialization inside the MII_MODE selection.

    #ifdef MII_MODE /* Mode MII with STM324xG-EVAL */
    #ifdef PHY_CLOCK_MCO

    GPIO_Init(GPIOA, &GPIO_InitStructure);
    /* Output HSE clock (25MHz) on MCO pin (PA8) to clock the PHY */
    RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);
    #endif /* PHY_CLOCK_MCO */

    (Other GPIO configurations (pin,speed,mode,OType,PuPd) are outside this condition.)

    4) Ethernet clocks is started after the software reset of ethernet.

    /* Reset ETHERNET on AHB Bus */
    ETH_DeInit();

    /* Software reset */
    ETH_SoftwareReset();

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
    RCC_AHB1Periph_ETH_MAC_Rx, ENABLE);
    5)#define USE_DHCP and commented out version (//#define USE_DHCP) are both tried.

    6)”#define RMII_MODE” and “//#define MII_MODE”

    7)My Airties modems(also gateway) ip is 192.168.2.1
    My PC’s ip is 192.168.2.20(no automatic ip , this is static on ipv4 settings)
    The static ip defined on the code for the board is 192.168.2.27
    The subnet of the network is 255.255.255.0
    DHCP settings of the router start adress 192.168.2.20- end adress 192.168.2.30 and three computers are using the LAN(the last one’s ip 192.168.2.22)

    CASES that i have tried;

    When i powered the module and the board i get the link led(orange one) always on and the data led(green one) blinking.

    1)When i use “dhcp on” mode for the discovery board i couldn’t even ping or get the webpage on browser. In the wireshark screen i get “dhcp discover” lines for 4 times but no response from the router and discovery cannot get and ip.

    “125 39.520406000 0.0.0.0 255.255.255.255 DHCP 350 DHCP Discover – Transaction ID 0xabcd0001”

    2)When i use “dhcp off” mode no ping response and no webpage again.On the wireshark screen i get

    02:00:00:00:00:00 Broadcast ARP 60 Gratuitous ARP for 192.168.2.27 (Request)

    but no response from the router.

    3)When i dismiss the router and get connected the discovery and the computer with a straight ethernet cable(dhcp off mode for the board) i cannot ping the module and cannot reach the webpage.

    In all cases i cannot see the board in the list for “arp -a” command. I checked the cabling 3-4 times so i dont think there is a mistake with it. I need some help and advice thanks in advance..

    Kadir

  53. Kadir Cimenci
    January 25th, 2013 at 09:08 | #53

    sorry for twice entries..
    Kadir

  54. Joe
    January 28th, 2013 at 07:38 | #54

    Hi,
    I am using a phy from Micrel(KSZ8041NL) ,I have downloaded your code and made changes to the phy register values in the stm32f4x7_eth_conf_template.h file but the project is not working.I am using MII mode in this project.Help needed….

    Thanks in advance….

  55. kadir4172
    January 29th, 2013 at 09:16 | #55

    hi everyone,

    im using stm32f4 discovery board and dpxxxx as phy module. The changes i have made on the lwip example of st(standalone->httpserver example)

    1) gpio alternative function definitions and initializations for PA1,PA2,PA7,PC4,PC5,PC1,PB11,PB12,PB13
    2) Definition of HSE value as 8000000hz and pll_m value as 8
    3) Moving the MCO pin (PA8) initialization inside the MII_MODE selection.

    #ifdef MII_MODE /* Mode MII with STM324xG-EVAL */
    #ifdef PHY_CLOCK_MCO

    GPIO_Init(GPIOA, &GPIO_InitStructure);
    /* Output HSE clock (25MHz) on MCO pin (PA8) to clock the PHY */
    RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);
    #endif /* PHY_CLOCK_MCO */

    (Other GPIO configurations (pin,speed,mode,OType,PuPd) are outside this condition.)

    4) Ethernet clocks is started after the software reset of ethernet.

    /* Reset ETHERNET on AHB Bus */
    ETH_DeInit();

    /* Software reset */
    ETH_SoftwareReset();

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
    RCC_AHB1Periph_ETH_MAC_Rx, ENABLE);
    5)#define USE_DHCP and commented out version (//#define USE_DHCP) are both tried.

    6)â?#define RMII_MODEâ? and â??//#define MII_MODEâ?

    7)My Airties modems(also gateway) ip is 192.168.2.1
    My PCâ??s ip is 192.168.2.20(no automatic ip , this is static on ipv4 settings)
    The static ip defined on the code for the board is 192.168.2.27
    The subnet of the network is 255.255.255.0
    DHCP settings of the router start adress 192.168.2.20- end adress 192.168.2.30 and three computers are using the LAN(the last oneâ??s ip 192.168.2.22)

    CASES that i have tried;

    When i powered the module and the board i get the link led(orange one) always on and the data led(green one) blinking.

    1)When i use â??dhcp onâ? mode for the discovery board i couldnâ??t even ping or get the webpage on browser. In the wireshark screen i get â??dhcp discoverâ? lines for 4 times but no response from the router and discovery cannot get and ip.

    â??125 39.520406000 0.0.0.0 255.255.255.255 DHCP 350 DHCP Discover — Transaction ID 0xabcd0001â?³

    2)When i use â??dhcp offâ? mode no ping response and no webpage again.On the wireshark screen i get

    02:00:00:00:00:00 Broadcast ARP 60 Gratuitous ARP for 192.168.2.27 (Request)

    but no response from the router.

    3)When i dismiss the router and get connected the discovery and the computer with a straight ethernet cable(dhcp off mode for the board) i cannot ping the module and cannot reach the webpage.

    In all cases i cannot see the board in the list for â??arp -aâ? command. I checked the cabling 3-4 times so i dont think there is a mistake with it.I have tried all of the configurations with cross and straight ethernet cables. I need some help and advice thanks in advance..

    Kadir

  56. vaidas
    February 16th, 2013 at 01:42 | #56

    @kadir4172
    plug your board straight to PC, check pinout one more time and put long delay after your ethernet chip in main(20-100ms), disable DHCP and make sure, that you are in the same subnet as your board is(maby you ar checking wireless card’s IP, not cable ethernet card?) my pin configuration looks like this:

    void ETH_GPIO_Config(void)
    {
    GPIO_InitTypeDef GPIO_InitStructure;

    /* Enable GPIOs clocks */
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
    RCC_AHB1Periph_GPIOC, ENABLE);

    /* Enable SYSCFG clock */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

    /* Configure MCO (PA8) */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;

    /* MII/RMII Media interface selection ————————————–*/
    #ifdef MII_MODE /* Mode MII with STM324xG-EVAL */
    #ifdef PHY_CLOCK_MCO
    //cia perkeliau ir virsaus, kad butu salygine kompiliacija A portui. Vaidas
    GPIO_Init(GPIOA, &GPIO_InitStructure);

    /* Output HSE clock (25MHz) on MCO pin (PA8) to clock the PHY */
    RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);
    #endif /* PHY_CLOCK_MCO */

    SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_MII);
    #elif defined RMII_MODE /* Mode RMII with STM324xG-EVAL */

    SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
    #endif

    /* Configure PA1(RMII_REF_CLK), PA2(ETH_MDIO), PA3(MII_INT) and PA7(RMII_CRS_DV) */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_7;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
    GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);

    /* Configure PB11(RMII_TX_EN), PB12(RMII_TXD0) and PB13(RMII_TXD1) */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
    GPIO_Init(GPIOB, &GPIO_InitStructure);
    GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_ETH);

    /* Configure PC1(ETH_MDC), PC4(RMII_RXD0) and PC5(RMII_RXD1) */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
    GPIO_Init(GPIOC, &GPIO_InitStructure);
    GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
    GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);

    }

    it works just fine for me. Btw, I’m using KEIL.

  57. gabriel
    February 21st, 2013 at 04:29 | #57

    [cc] C:UsersustronicDownloadsSTM32F4DISCOVERY_Ethernet-PhySTM32F4x7_ETH_Driversrccoreraw.c:238:5: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘u32_t’ [-Wformat]
    [cc] C:UsersustronicDownloadsSTM32F4DISCOVERY_Ethernet-PhySTM32F4x7_ETH_Driversrccoreraw.c:238:5: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘u32_t’ [-Wformat]
    [cc] Starting link
    [cc] arm-none-eabi-gcc -O0 -nostartfiles -Wl,-Map=STM32F4DISCOVERY_Ethernet-Phy.map -mcpu=cortex-m4 -mthumb -LC:UsersustronicDownloadsSTM32F4DISCOVERY_Ethernet-Phy -Wl,–gc-sections -Wl,-TC:UsersustronicDownloadsSTM32F4DISCOVERY_Ethernet-Phyarm-gcc-link.ld -g -o STM32F4DISCOVERY_Ethernet-Phy.elf ..objstm32f4xx_syscfg.o ..objmem.o ..objtcp.o ..objerr.o ..objrandm.o ..objmib_structs.o ..objtcp_in.o ..objstm32f4xx_usart.o ..objslipif.o ..objmemp.o ..objautoip.o ..objip_frag.o ..objmsg_out.o ..objnetbuf.o ..objtcpip.o ..objstm32f4xx_dac.o ..objasn1_dec.o ..objlcp.o ..objfsdata.o ..objvj.o ..objfs.o ..objstartup_stm32f4xx.o ..objstm32f4_discovery.o ..objstm32f4x7_eth.o ..objsys.o ..objip_addr.o ..objinet_chksum.o ..objmain.o ..objstm32f4xx_rcc.o ..objnetconf.o ..objmib2.o ..objstm32f4xx_it.o ..objnetdb.o ..objinit.o ..objstm32f4xx_adc.o ..objstm32f4x7_eth_bsp.o ..objprintf.o ..objethernetif.o ..objchpms.o ..objetharp.o ..objhttpd.o ..objmagic.o ..objhttpd_cgi_ssi.o ..objpbuf.o ..objstats.o ..objinet.o ..objmsg_in.o ..objnetif.o ..objasn1_enc.o ..objfsm.o ..objapi_msg.o ..objchap.o ..objstm32f4xx_gpio.o ..objmd5.o ..objsystem_stm32f4xx.o ..objsyscalls.o ..objsockets.o ..objigmp.o ..objpap.o ..objudp.o ..objip.o ..objauth.o ..objstm32f4xx_exti.o ..objppp_oe.o ..objicmp.o ..objdns.o ..objnetifapi.o ..objmisc.o ..objapi_lib.o ..objdhcp.o ..objppp.o ..objserial_debug.o ..objipcp.o ..objtcp_out.o ..objloopif.o ..objraw.o
    [cc] ..objfs.o:(.rodata+0x0): multiple definition of `file__STM32F4x7_files_ST_gif’
    [cc] ..objfsdata.o:(.rodata+0x0): first defined here
    [cc] ..objfs.o:(.rodata+0xcc14): multiple definition of `file__STM32F4x7_files_logo_jpg’
    [cc] ..objfsdata.o:(.rodata+0xcc14): first defined here
    [cc] ..objfs.o:(.rodata+0xcc28): multiple definition of `file__STM32F4x7_files_stm32_jpg’
    [cc] ..objfsdata.o:(.rodata+0xcc28): first defined here
    [cc] ..objfs.o:(.rodata+0xcc3c): multiple definition of `file__STM32F4x7LED_html’
    [cc] ..objfsdata.o:(.rodata+0xcc3c): first defined here
    [cc] ..objfs.o:(.rodata+0xcc50): multiple definition of `file__404_html’
    [cc] ..objfsdata.o:(.rodata+0xcc50): first defined here
    [cc] ..objfs.o:(.rodata+0xcc64): multiple definition of `file__index_html’
    [cc] ..objfsdata.o:(.rodata+0xcc64): first defined here
    [cc] ..objfs.o:(.rodata+0xcc78): multiple definition of `file__STM32F4x7ADC_shtml’
    [cc] ..objfsdata.o:(.rodata+0xcc78): first defined here
    [cc] collect2: ld returned 1 exit status

    BUILD FAILED
    Total time: 1 minute 7 seconds

    i have this error please help me

  58. February 22nd, 2013 at 18:12 | #58

    @gabriel
    This specific problem has been discussed in a previous comment and I have written a solution to it.
    Please read this solution from me: comment-55246

    Kind regards Thomas

  59. gabriel
    February 23rd, 2013 at 19:35 | #59

    thank you for your help it works

    [cc] 0 files to be recompiled from dependency analysis.
    [cc] 0 total files to be compiled.
    [cc] Starting link
    [cc] arm-none-eabi-gcc -O0 -nostartfiles “-Wl,-Map=proyecto ethernet.map” -mcpu=cortex-m4 -mthumb “-LC:proyecto ethernet” -Wl,–gc-sections “-Wl,-TC:proyecto ethernetarm-gcc-link.ld” -g -o ‘”proyecto ethernet.elf”‘ ..objstm32f4xx_syscfg.o ..objmem.o ..objtcp.o ..objerr.o ..objrandm.o ..objmib_structs.o ..objtcp_in.o ..objstm32f4xx_usart.o ..objslipif.o ..objmemp.o ..objautoip.o ..objip_frag.o ..objmsg_out.o ..objnetbuf.o ..objtcpip.o ..objstm32f4xx_dac.o ..objasn1_dec.o ..objlcp.o ..objvj.o ..objfs.o ..objstartup_stm32f4xx.o ..objstm32f4_discovery.o ..objstm32f4x7_eth.o ..objsys.o ..objip_addr.o ..objinet_chksum.o ..objmain.o ..objstm32f4xx_rcc.o ..objnetconf.o ..objmib2.o ..objstm32f4xx_it.o ..objnetdb.o ..objinit.o ..objstm32f4xx_adc.o ..objstm32f4x7_eth_bsp.o ..objprintf.o ..objethernetif.o ..objchpms.o ..objetharp.o ..objhttpd.o ..objmagic.o ..objhttpd_cgi_ssi.o ..objpbuf.o ..objstats.o ..objinet.o ..objmsg_in.o ..objnetif.o ..objasn1_enc.o ..objfsm.o ..objapi_msg.o ..objchap.o ..objstm32f4xx_gpio.o ..objmd5.o ..objsystem_stm32f4xx.o ..objsyscalls.o ..objsockets.o ..objigmp.o ..objpap.o ..objudp.o ..objip.o ..objauth.o ..objstm32f4xx_exti.o ..objppp_oe.o ..objicmp.o ..objdns.o ..objnetifapi.o ..objmisc.o ..objapi_lib.o ..objdhcp.o ..objppp.o ..objserial_debug.o ..objipcp.o ..objtcp_out.o ..objloopif.o ..objraw.o
    Program Size:
    text data bss dec hex filename
    151532 2284 34260 188076 2deac proyecto ethernet.elf

    BUILD SUCCESSFUL
    Total time: 16 seconds

  60. March 8th, 2013 at 11:36 | #60

    @Kadir Cimenci

    I have found a similar problem. I am working on STM32F407 + DP83848 + LwIP.

    However I have looking in the data packet with wireshark.. and comparing with another DHCP packet (the valid, and working.

    I have Looked on BOOTSTRAP Protocal . and saw that the “Bootp flags” was 0x000 which is unicast.

    from my understanding , I should be “BROADCAST” , 0x8000.

    then I checked line 845 in “dhcp.c” in the driver ,

    dhcp_option_byte(dhcp, DHCP_OPTION_BROADCAST);

    it said “BROADCAST” with

    #define DHCP_OPTION_BROADCAST 28

    in dhcp.h.

    Dose it a bug? or something? Is my understanding correct?

    Furthermore the packet size is larger than another computer’s packet.
    STM32F4+LwIP generates 350Bytes Packet, But another working computer generates 350 Bytes DHCP Discovery Packet.

    //——————————————————
    I have Fix other problems such as ,
    MCO init in MII mode
    PLL Clock and divider
    ETH-Pher Clock initial after ETH reset. Fixing Forever Loop in ETH_Init();
    Reinit system clk after system init in ther starting of main();
    Configs Port.

  61. shresta
    March 10th, 2013 at 07:08 | #61

    Will this code compile on keil uvision?

  62. shresta
    March 10th, 2013 at 10:10 | #62

    build failed because of “collect2.exe: error: ld returned 1 exit status”
    what might be the problem?

  63. shresta
    March 10th, 2013 at 10:17 | #63

    thomas u are awesome man!!

  64. Maniek
    March 10th, 2013 at 10:37 | #64

    Can you explain your words : “Because the STM32F4DISCOVERY board only contains the 100-pin version some of the full MII pins are missing so we have to use the PHY in RMII mode.”. Which of the pins are missing? In my opinion every pins are available in 100pins STM32F4 version on STM F4 Discovery.

  65. shresta
    March 11th, 2013 at 04:43 | #65

    The webpage opens a cgi code. its action is to open the page to control 4 LEDS. But i need a LED per page. How do i program to do it.. Please reply..

  66. elfo106
    March 18th, 2013 at 21:53 | #66

    Hi guys, im trying to compile it in IAR but I’m getting one error that I can’t figure it out.

    Error[Pe067]: expected a “}” D:MicrocontroladoresSTSTM32F4-DiscoveryethernetEthernetsourcehttpd_cgi_ssi.c 40

    That line is like this:

    char const** TAGS= { &TAGCHAR, &TAGCHAR2 };

    Any suggestions?

    Thank you!!

  67. Thomas Kaiser
    March 19th, 2013 at 21:46 | #67

    Maybe i’m blind, but i can’t see an option to exclude “fsdata.c” from build…
    I’m working with CoIDE version 1.7.0
    Any suggestions

  68. P_K
    March 23rd, 2013 at 15:26 | #68

    How to refresh HTML page with use user button on the board?

  69. March 24th, 2013 at 11:23 | #69

    @P_K
    You would have to elaborate on what you mean by “refresh”.
    Do you want to change the content of a page when pressing the button, or would you like the page to be refreshed inside of the external browser when the button is pressed?

  70. March 26th, 2013 at 22:27 | #70

    @Thomas Kaiser
    I am currently still running CoIDE 1.5.1 due to some project structure changes in 1.6.0.
    In my version I am able to right click on the file in the left file-structure panel and select “Exclude from Build…”

  71. Nancy
    March 31st, 2013 at 13:54 | #71

    @Thomas Jespersen
    Hi, can you tell me how to revise the code to adjust to the STM32F407DISCOVERY board, bcz the code the ST supply is for the board named STM3240G-EVAL evaluation board.

  72. P_K
    April 8th, 2013 at 17:49 | #72

    @Thomas Jespersen
    If I press one a button I want change the content of a page, but if another page to be refreshed inside of the external browser

  73. storm
    April 9th, 2013 at 10:18 | #73

    @vaidas
    Hi I have did which like you say,but unfortunately it not work correctï¼?when i try to ping,the pc point me that request timed out .can you help me ?what i should do?

  74. May 3rd, 2013 at 14:08 | #74

    Hi,
    The example is just awsome!
    I will use lwIP for my own project and you helped me a lot!
    Thank you!

    Marek

  75. Dean
    June 29th, 2013 at 03:58 | #75

    @Thomas Jespersen
    Hi,
    Thanks for the project.
    I am having the same problem with the error:
    [cc] collect2: ld returned 1 exit status
    BUILD FAILED

    I am using CoIDE V1.7.2, when I right click on the file â??fsdata.câ? I don’t get the â??Exclude from Buildâ? option. Is there a new way to exclude the file from the build that I’m missing, sorry I’m a total newby with CoIDE and STM32F4.
    Your assistance would be much appreciated.
    Regards,
    Dean.

  76. June 30th, 2013 at 07:51 | #76

    @Dean
    Yet again the problem has to do with the CoIDE version, as they have removed the ‘Exclude’ option after V1.6.0!
    You can try and delete the file ‘fsdata.c’. If not that works you need to downgrade you CoIDE version and inatall 1.5.1 instead.

    Regards Thomas

  77. Dean
    July 2nd, 2013 at 11:08 | #77

    @Thomas Jespersen
    Hi Thomas,
    Yes, I found on the CoIDE help forum that they had removed the ‘exclude’ option (a few people are asking for it to be put back in) so I deleted the ‘fsdata.c’ file from the project, it just deletes the link to the file not the file itself. So now I can get the project to compile in CoIDE V1.7.2.

    I am getting a lot of warnings along the lines of “warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘u32_t'” probably not too much to worry about but I do prefer to get a ‘clean’ compile without warnings where I can.

    I actually have the STM32F4-Base board which has the DP83848 phy chip not the LAN8720 described in this project so I suppose I now need to modify the project back to the original demo files to get it to work with the DP83848.

    Thanks for your help.
    Regards,
    Dean.

  78. July 2nd, 2013 at 13:50 | #78

    @Dean
    Glad you worked it out.
    You can safely ignore those warnings as an unsigned int corresponds to the same as a u32 when compiled.

    Regards Thomas

  79. Saurav
    July 31st, 2013 at 10:24 | #79

    Hi Thomas,
    What was the code size that you had for this project?
    I am using the firmware example from STM but that has a size of around 42kB and the limit for the software tool is 32kB.
    Regards,
    Saurav

  80. August 1st, 2013 at 16:06 | #80

    @Saurav
    I am using CooCox CoIDE to compile this project.
    This compiler is a free compiler without any limitations, so which kind of limitation are you referring to? Debugging?

    Regards Thomas

  81. Saurav
    August 2nd, 2013 at 10:25 | #81

    @Thomas Jespersen
    Yes, I am referring to the debugging limit. I am currently using Keil uV4. I am actually implementing just an echo server to start off with. What I did was to comment out the glcd sections of the code and remove the .h file for the same. I was able to get it below 32kB.

  82. Saurav
    August 2nd, 2013 at 10:26 | #82

    @Thomas Jespersen
    Now however, I am stuck with an unreachable destination host when I use Ping.
    Note that I am able to run my debug session on uV. So the board is definitely alive.My setup is like this:
    Main board: Discovery kit with the 407VG controller.
    Base Board from STM with a 8270 PHY.
    USB to miniUSB between my system and the discovery board.
    LAN cable between my system and the discovery.
    I am using the default ping command (The board has a static ip address, at least thats the default setting in the code).
    Observations: Destination host unreachable. However when I use debug and step by step execution the board always detects a packet received. (Even when I’m not pinging it.)
    Any ideas?
    Regards,
    Saurav

  83. Saurav
    August 2nd, 2013 at 10:35 | #83

    @Thomas Jespersen
    I should mention that I’m not using the code here. I am using one that is provided as an example code for the baseboard. I’m wondering if you have any pointers as to why the host would be unreachable. I’m new to ethernet so any pointer would help!
    Regards,
    Saurav

  84. Krzysztof
    August 19th, 2013 at 20:21 | #84

    Hello.

    I have CoIDE ver. 1.7.4 and i don’t have “Exclude from build” option. Can anyone help me?

  85. Krzysztof
    August 22nd, 2013 at 15:20 | #85

    Hello. Does anyone whom http server works, can share files? I will be very thankful
    Please help me…

    e-mail: krzysztofgieldzinski@gmail.com

  86. Archie
    October 16th, 2013 at 19:56 | #86

    I’ve tried to run your software with my own setup (stm32f4discovery + dp83848) But the program stays always in this while:
    while (ETH_GetSoftwareResetStatus() == SET);
    After a while the while construct is passed by the board is not connected to lan. I have checked the IO many times, the LAN cable is also well. Any idea why this code can’t run?

  87. October 19th, 2013 at 20:14 | #87

    @Archie
    It sounds like the RMII pins and interface of the STM32F4 have not been initialized properly.
    How long are the wires between the STM32 and the PHY board?

  88. sisa
    October 28th, 2013 at 10:32 | #88

    @shresta
    Hi, can you tell me, how did you solve this problem? I have the same one and I don’t know, how to solve it.
    Thank you very much. Have a nice day

  89. sisa
    October 28th, 2013 at 16:37 | #89

    @sisa
    Sorry for interupt you. I just know how to make it:D

  90. Starstuff
    October 30th, 2013 at 01:35 | #90

    @shresta

    How did you fix the “collect2.exe” error?

  91. Starstuff
    October 30th, 2013 at 01:52 | #91

    @Starstuff

    Disregard my previous comment… I found the solution.

  92. Starstuff
    October 30th, 2013 at 01:56 | #92

    I need to thank the author for this code, now I can get into learning how things work without deviating my attention to other things.

    CooCox is a great tool too,

    robert

  93. October 31st, 2013 at 09:22 | #93

    @Starstuff
    Hi there.
    Glad to know that you got it working.
    CoIDE is a great tool indeed. Hopefully this will help a lot of people to get into ARM programming easier.

    Regards Thomas

  94. Ngominhtri
    December 5th, 2013 at 05:28 | #94

    Hi, I am using KeilC. I just modified like this page http://www.aimagin.com/tgr/tgr12/amgf4connect/doc/HTML/index.html?webpage_configuration.htm, but I can’t ping the IP Address of board. Please help me.
    @Thomas Jespersen

  95. Ngominhtri
    December 5th, 2013 at 11:11 | #95

    Hi, I debuged and measured DP83848 on OSC, but no signal on MDC pin. Please help me..
    @Thomas Jespersen

  96. Ngominhtri
    December 6th, 2013 at 05:22 | #96

    Hi Thomas Jespersen,
    I have modified and connected like you are. But, I can’t run this code demo on STM32F4 Discovery with DP83848 in RMII mode. Could you send me a code has runned.

    Email: ngominhtrint@gmail.com

  97. Ngominhtri
    December 11th, 2013 at 09:49 | #97

    @Thomas Jespersen
    Hi,
    I build and downloaded into kit successfuly, but when i ping the IP addr, it can’t run.
    How can I test the hardware (DP83848 ETH module)

  98. January 18th, 2014 at 10:48 | #98

    @Ngominhtri
    Have you compiled the Keil project correctly? If you don’t see any signal on the MDC pin it sounds like your project hasn’t been configured correctly.
    As I did in the CooCox project (for the STM32), changing some of the initial configuration code lines for the connected PHY, you have to remember to do the same in your Keil project, to get the DP83848 module working with the microprocessor.

    Regards Thomas

  99. January 18th, 2014 at 10:50 | #99

    @Ngominhtri
    So you have downloaded the CooCox project I made, which I have confirmed is working with our DP83848 module?
    Please make sure that your cables are short and well connected. I found it very troublesome most of the times because I was using too long wires.
    Have you measured the signals from the Phy? Do you get any activity at all.

    Pinging the IP address will only work if the device (microprocessor) has actually managed to get the IP address and is able to communicate with the router.
    If your PHY connections are not wrong or the communication is being interrupted you will not be able to ping the board.

    Regards Thomas

  100. February 7th, 2014 at 01:15 | #100

    Hi,

    I am new to the STM32F4, I am using Atollic TruStudio for Arm Lite, I imported the project but the debug button is greyed out also when I build the project it gives me this error “Errors occurred during the build.
    Errors running builder ‘CDT Builder’ on project ‘STM32F4_Ethernet’.
    java.lang.NullPointerException”

    Please Help me.

    Thank you.

  101. Michael
    February 11th, 2014 at 11:27 | #101

    @kadir4172

    Hello, I have exactly the same problem as you. Have you managed to solve it?

    Best Regards,
    Michal

  102. February 17th, 2014 at 23:31 | #102

    @shresta
    The project is not made for Keil, no.
    You should be using the free CooCox CoIDE which uses the GNU GCC compiler.

  103. February 17th, 2014 at 23:32 | #103

    @Erik
    The project is not made for Atollic TrueStudio even though it is using the GNU GCC compiler as well.
    To get it work in Atollic you would have to change some of the project inclusion settings.
    But I would just recommend you to use the free CooCox CoIDE!

  104. Henk
    February 25th, 2014 at 11:33 | #104

    I manage to fix most errors to build this project.
    last things i have a problem with is the error multiple definition ………

    [cc] Parsing ……STM32F4x7_ETH_Driversrcnetifpppipcp.c
    [cc] Parsing ……STM32F4x7_ETH_Driversrccoretcp_out.c
    [cc] Parsing ……STM32F4x7_ETH_Driversrccoreraw.c
    [cc] 76 files are up to date.
    [cc] 0 files to be recompiled from dependency analysis.
    [cc] 0 total files to be compiled.
    [cc] Starting link
    [cc] arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -g -nostartfiles -Wl,-Map=STM32F4_Ethernet.map -O0 -Wl,–gc-sections -LF:tempCooCoxCoIDEconfigurationProgramDataSTM32F4_Ethernet -Wl,-TF:tempCooCoxCoIDEconfigurationProgramDataSTM32F4_Ethernet/arm-gcc-link.ld -g -o STM32F4_Ethernet.elf ..objstm32f4xx_syscfg.o ..objmem.o ..objtcp.o ..objerr.o ..objrandm.o ..objmib_structs.o ..objtcp_in.o ..objstm32f4xx_usart.o ..objslipif.o ..objmemp.o ..objautoip.o ..objip_frag.o ..objmsg_out.o ..objnetbuf.o ..objtcpip.o ..objstm32f4xx_dac.o ..objasn1_dec.o ..objlcp.o ..objfsdata.o ..objvj.o ..objfs.o ..objstartup_stm32f4xx.o ..objstm32f4x7_eth.o ..objstm32f4_discovery.o ..objsys.o ..objip_addr.o ..objinet_chksum.o ..objmain.o ..objstm32f4xx_rcc.o ..objnetconf.o ..objmib2.o ..objstm32f4xx_it.o ..objnetdb.o ..objinit.o ..objstm32f4x7_eth_bsp.o ..objstm32f4xx_adc.o ..objprintf.o ..objethernetif.o ..objchpms.o ..objetharp.o ..objhttpd.o ..objmagic.o ..objhttpd_cgi_ssi.o ..objpbuf.o ..objstats.o ..objinet.o ..objmsg_in.o ..objnetif.o ..objasn1_enc.o ..objfsm.o ..objapi_msg.o ..objchap.o ..objstm32f4xx_gpio.o ..objmd5.o ..objsystem_stm32f4xx.o ..objsyscalls.o ..objsockets.o ..objigmp.o ..objpap.o ..objudp.o ..objip.o ..objauth.o ..objstm32f4xx_exti.o ..objppp_oe.o ..objicmp.o ..objdns.o ..objnetifapi.o ..objmisc.o ..objapi_lib.o ..objdhcp.o ..objppp.o ..objserial_debug.o ..objipcp.o ..objtcp_out.o ..objloopif.o ..objraw.o
    [cc] ..objfs.o:(.rodata+0x0): multiple definition of `file__STM32F4x7_files_ST_gif’
    [cc] ..objfsdata.o:(.rodata+0x0): first defined here
    [cc] ..objfs.o:(.rodata+0xcc14): multiple definition of `file__STM32F4x7_files_logo_jpg’
    [cc] ..objfsdata.o:(.rodata+0xcc14): first defined here
    [cc] ..objfs.o:(.rodata+0xcc28): multiple definition of `file__STM32F4x7_files_stm32_jpg’
    [cc] ..objfsdata.o:(.rodata+0xcc28): first defined here
    [cc] ..objfs.o:(.rodata+0xcc3c): multiple definition of `file__STM32F4x7LED_html’
    [cc] ..objfsdata.o:(.rodata+0xcc3c): first defined here
    [cc] ..objfs.o:(.rodata+0xcc50): multiple definition of `file__404_html’
    [cc] ..objfsdata.o:(.rodata
    [cc] +0xcc50): first defined here
    [cc] collect2.exe: error: ld returned 1 exit status
    [cc] ..objfsdata.o:(.rodata+0xcc78): first defined here
    [cc] ..objfs.o:(.rodata+0xcc78): multiple definition of `file__STM32F4x7ADC_shtml’
    [cc] ..objfsdata.o:(.rodata+0xcc64): first defined here
    [cc] ..objfs.o:(.rodata+0xcc64): multiple definition of `file__index_html’

    BUILD FAILED
    Total time: 2 seconds

  105. February 26th, 2014 at 10:29 | #105

    @Henk
    The problem with these definitions has been discussed in a previous comment and I have written a solution to it.
    Please read this solution from me here: comment-55246

    Kind regards Thomas

  106. aamir
    March 6th, 2014 at 08:30 | #106

    I have downloaded example uses same connections as described above i am using wave share Ethernet board same as above but there is no response i am using IP address
    #define IP_ADDR0 192
    #define IP_ADDR1 168
    #define IP_ADDR2 0
    #define IP_ADDR3 111
    ie 192.168.0.111
    but not pinging

    I Have set PC IP address as
    192.168.0.112

  107. March 8th, 2014 at 19:34 | #107

    @aamir
    Do you connect the board to a router/gateway with an IP of 192.168.0.1?
    If not, you would have to change these settings as well.

  108. kahyas
    March 24th, 2014 at 22:38 | #108

    Hi all,
    Could you explane How the application is controlled from website? I couldnt see the code for that?

  109. April 2nd, 2014 at 22:56 | #109

    @kahyas
    That is just the original ST example where you enter the IP address of the device and a webpage shows up with the ST logo and some information.

  110. Nguyen Van Hieu
    April 5th, 2014 at 11:19 | #110

    Hi, Help me! I dowload and build. Ok, led blink but not find Address Mac, Ip

  111. Nguyen
    April 7th, 2014 at 05:12 | #111

    I dowload and build successful but not ping address ip.
    Route Gateway 192.168.1.1
    #define ip : 192.168.1.145

  112. Henk
    April 11th, 2014 at 14:50 | #112

    Hello Thomas,

    I tried your idea

    The solution to the problem is to right click at the file ?fsdata.c? found in the ?Ethernet/source? folder in the Project list, and then select ?Exclude from Build?.

    I use CooCox with STM32F4-BB Ethernet board, i read some documentation of coocox, there should be a similar function. But cannot find it.
    Should this PHY of the STM32F4-BB work with this project ?

  113. Henk
    April 11th, 2014 at 14:54 | #113

    Hello Thomas,

    I found it, your copy of this file was indeed in the project file.
    c:/coocox/coide/workspace/stm32f4_ethernet/ethernet/source/fsdata.c

    Hope to build this at last.

  114. Henk
    April 16th, 2014 at 13:22 | #114

    For the STM32F4-BB ( discovery with Ethernet Board ) use.
    PHY_ADDRESS 0x00
    #define RMII_MODE ( there is a 50Mhz oscillator onboard )
    //#define MII_MODE

    this could also be of some help.
    http://rose.eu.org/2013/category/logbook/page/14

  115. April 24th, 2014 at 22:25 | #115

    @Henk
    Thank you for the advice, Henk.
    This should definitely be usefull for the people trying to use our project with the Discovery+Ethernet board combination.

  116. Muhammad Faizan
    May 23rd, 2014 at 20:15 | #116

    Dear Sir Thomas,

    I am getting mac address 02:00:00:00:00:01 and ip address 192.168.15.4 in the lease status of my router but when I write the ip address in my address bar the tab keeps on loading and at the end this message “Oops! Google Chrome could not connect to 192.168.15.4
    Try reloading: 192.­168.­15.­4″appear kindly help me out as it is a part of my project.

  117. May 23rd, 2014 at 21:57 | #117

    @Muhammad Faizan
    Can you please try and ping the device and see if it responds to the pings.
    You could also try to insert a breakpoint in the webserver entry point in the C-code of the STM32 device, to see if the code actually recognizes your request and tries to parse it.

  118. luigi
    May 24th, 2014 at 11:08 | #118

    Hello, can you help to make Interfacing to STM32F4x7 lwIP Ethernet network interface? I do not know where to start. What should I install on eclipse? What should I download?

  119. Muhammad Faizan
    May 24th, 2014 at 20:11 | #119

    @Sir Thomas
    I tried to ping but the dos prompt is showing “Destination host unreachable ” and once it showed “timed out” I am really confused how to solve this issue . Can the lenght of wires be cause of this issue it is about 15 cms?

  120. Jo Su
    May 28th, 2014 at 11:47 | #120

    @Muhammad Faizan
    Hey
    I’ve got the same problem. My MAC adress is 50:32:75:57:AA:0B and ip works too 192.168.0.101.
    But i got no ping.

  121. May 29th, 2014 at 18:51 | #121

    @Jo Su
    So does the webserver part work for you?

  122. luigi
    May 29th, 2014 at 18:56 | #122

    web server no work.What’s the problem?

  123. Muhammad Faizan
    June 2nd, 2014 at 11:05 | #123

    Long wires b/w stm32f4 and shield it should be abt 5cms

  124. saad
    June 2nd, 2014 at 18:22 | #124

    every thing is working fine for me but i need to do tcp communication so kindly tell me the changes that i have to make to convert this project to a tcp echo server project as provided for STM3240G-EVAL evaluation board on keil.

  125. Jo Su
    June 3rd, 2014 at 07:01 | #125

    @Muhammad Faizan
    Really? At the video they are about 20 cms…!?

  126. Jo Su
    June 5th, 2014 at 07:24 | #126

    @Muhammad Faizan
    I’ve shorten the wires. Now it works.

  127. June 5th, 2014 at 11:43 | #127

    @Jo Su
    Glad that it works now.
    And thanks a lot on the notice to remember short wires!

  128. sanjib das
    June 16th, 2014 at 10:32 | #128

    There was no option for “exclude from build” in my coocox version so i have deleted the file fsdata.c after that I build my project and it gets build and it looks like this

    Program Size:
    text data bss dec hex filename
    152328 2284 34260 188872 2e1c8 STM32F4_Ethernet.elf

    BUILD SUCCESSFUL
    Total time: 2 seconds

    which doesn’t match the above program size, So I rebuild it again then it gives me error like
    :20: fatal error: fsdata.c: No such file or directory . whay that so I am not understanding please help what shud i do?

  129. sanjib das
    June 16th, 2014 at 11:22 | #129

    If i comment the # include fsdata.h in fs.c file then it gives me error FS_ROOT difined first time should I delete fs.c file too please help

  130. sanjib das
    June 16th, 2014 at 12:19 | #130

    I solved the error …..can you say me what changes that i have to make to convert this project to a tcp echo server project . Please help me

  131. metcenger
    August 16th, 2014 at 10:33 | #131

    Hi Thomas!
    Thanks for working adaptation with dp83848. But there is one problem with IP. When work like in Your project (#define USE_DHCP)- all works fine. But when I want to use static IP adress and comment #define USE_DHCP, at this case device does not receive IP and does not respond to pings from console. I can’t understand why?

  132. August 27th, 2014 at 21:25 | #132

    @metcenger
    Are you sure that you assign and tell the lwIP to use the static IP as well.
    But actually just removing the definition of USE_DHCP should make it work with static IP as the example is taken directly from the STM32F4 Ethernet Example provided by ST, I’ve just changed the low-level Phy drivers to make it work with the DP83848.

  133. parthiban
    September 5th, 2014 at 13:07 | #133

    Great Work!!! Its really helped me a lot. It works fine with http protocol. Am trying to port it to tcp protocol, but finding it quite difficult since am new to the tcp protocol. Any suggestions would be grateful.

  134. Ed
    September 12th, 2014 at 20:36 | #134

    Thanks for sharing.
    It’s working now, but had some problems due long wires.

  135. Ed
    September 14th, 2014 at 16:40 | #135

    I Have updated (most) of the drivers to Ver 1.1.0 and fixed some minor issues.
    Dynamic IP is now working and even more important the webpage is now loading in a blink of an eye.
    http://evertdekker.com/wp/?wpdmact=process&did=My5ob3RsaW5r
    It’s compiled with Coide 1.7.7. In the zip file is also Em::Blocks (ebp) project file for those who want to use this compiler.

  136. September 14th, 2014 at 23:09 | #136

    @Ed
    What a great job. Glad that you managed to get it working that well.
    Would you mind uploading the project again so I can get a hold of it and confirm your changes?

  137. Ed
    September 15th, 2014 at 08:06 | #137

    Hi Thomas,
    I don’t know what you mean by “upload the project again” you can download it from my website with the link given in the above post.

  138. September 15th, 2014 at 16:24 | #138

    @Ed
    Thanks.
    Apparently the link didn’t seem to work yesterday, but it is working now.

  139. Pravinkumar
    January 12th, 2015 at 05:21 | #139

    Hai all,

    I got the project and build successfully..Kindly anyone suggest me,how to test the project??

    Thank You

  140. January 13th, 2015 at 01:07 | #140

    @Pravinkumar
    What do you mean? Have you build it and connected it to the STM32 board as well?
    If so you should easily be able to just download the CoIDE project, compile and start a debugging session to program the board and test it.

  141. jo
    February 2nd, 2015 at 17:57 | #141

    Is there any known problem with using timer?
    I also want to user a timer (tim2 for can message) but it never counts!?

  142. February 3rd, 2015 at 14:53 | #142

    @jo
    As far as I remember and by quickly checking the code Timer 2 doesn’t seem to be in use, so you should indeed be able to use it.
    Please make sure to enable both the clock for the timer periphiral and for the GPIO and CAN controller if used in conjuction?
    Furthermore please make sure to use the proper timing settings and that the HCLK is set right.

  143. jo
    February 3rd, 2015 at 18:47 | #143

    Thanks for the fast answer. There i’ve got to search… but use timer 2… perhaps i added to much.
    And are problems with spi(3)?
    I hope it’s the last question…
    Greetz

  144. Pravinkumar
    February 11th, 2015 at 07:06 | #144

    In Ethernet sample (STM32F407) der is MACRO as TCP segment size.
    /* TCP Maximum segment size. */
    #define TCP_MSS (2017 – 40) /* TCP_MSS = (Ethernet MTU – IP header size – TCP header size) */

    Using this i am able to get the data.But i cant able to receive more than 1977(2017 – 40) in server.If i increase more than this i am not getting any data.

    How can i set Ethernet Configuration parameters to receive more data in STM32F407.

    Kindly anyone help me plz plz…

  145. Henk
    March 25th, 2015 at 14:10 | #145

    Has any one tried this example to use DHCP ?

    Some how the lwip, doesn;t get an IP address.

  146. March 28th, 2015 at 22:14 | #146

    @Pravinkumar
    What do you mean with the server not being able to receive more data? When you refer to the server, do you mean the STM32F4 device running the webserver?
    If so, what type of data are you transmitting that is larger than 1977.
    This amount of bytes is meant to allow a usual HTTP package with the header and post/get parameters if any. But it doesn’t allow enough room for file transfers, if this is what you are trying to.

  147. March 28th, 2015 at 22:20 | #147

    @Henk
    We tried to get DHCP to work but LWIP seems to be struggling with the implementation as well.
    To get it working you could try and update the LWIP version.
    You could also try and have a look at the following code from another project of ours where we have successfully been using the DHCP feature: https://github.com/TKJElectronics/IoT_Football/blob/master/netconf.c

  148. Rick
    April 27th, 2015 at 14:31 | #148

    How can I port it to STM32F107 and cubeMx ?thanks

  149. April 27th, 2015 at 19:35 | #149

    @Rick
    First of you would have to use a different set of standard periphirals library to match the F107 device. This could be done thru the CubeMX.
    Though I have only tried the CubeMX software briefly and was very disapointed due to failing generators and buggy code. So I can’t tell you how to integrate this specific Phy project into the CubeMX, but you should be able to modify the generated code to match this Phy setup.

  150. Ginny
    May 13th, 2015 at 09:56 | #150

    Hi Thomas !
    I have a question ! I builted successfully, but t cann’t connect to httpserver , help me ! thanks…

  151. vignesh
    July 11th, 2015 at 06:10 | #151

    where can i download makefsdata.exe… help me out..
    thanks in advance

  152. July 12th, 2015 at 14:29 | #152

    @vignesh
    Please read the bottom section of the post which says:
    …there is a very simple way to generate your own new HTML files using the ?makefsdata.exe? file found inside the ?STM32F4x7_ETH_LwIP_V1.0.0UtilitiesThird_PartyPC_Software? folder.
    Please read more about how to do so at the following page: http://www.aimagin.com/tgr/tgr12/amgf4connect/doc/HTML/index.html?webpage_configuration.htm

  153. Rick
    July 18th, 2015 at 05:39 | #153

    I tried with STM32F107VCT6, but I can’t ping the board,
    I use STM32CubeMx…..

    I don’t understand why…? any clues ?thanks

  154. July 18th, 2015 at 10:46 | #154

    @Rick
    This project has not been prepared for use with STM32CubeMx due to the updated libraries included in this toolset.

  155. Mattias Norlander
    September 21st, 2015 at 14:15 | #155

    Ed :
    I Have updated (most) of the drivers to Ver 1.1.0 and fixed some minor issues.
    Dynamic IP is now working and even more important the webpage is now loading in a blink of an eye.
    http://evertdekker.com/wp/?wpdmact=process&did=My5ob3RsaW5r
    It?s compiled with Coide 1.7.7. In the zip file is also Em::Blocks (ebp) project file for those who want to use this compiler.

    Hi guys,
    I am currently struggling with hooking up the Phy and getting FreeRTOS +LwIP running on the STM32F4-Discovery board. So far failing miserably. As a start template I have tried converting the STM32F4Cube project called “LwIP_HTTP_Server_Socket_RTOS” (STM32Cube_FW_F4_V1.7.0ProjectsSTM324xG_EVALApplicationsLwIPLwIP_HTTP_Server_Socket_RTOS).
    I am doing this with Atollic TrueSTUDIO. So far I can build the project and debug it. I am setting up a static IP but I cannot ping it, not browse the website. Does not matter if I go trhough my LAN or correct directly to laptop.

    I downloaded your Coocox project Ed and migrated it to TrueSTUDIO. It now works! I can ping the device and browse the http-server. It is good to know that the PHY module and the wiring is correct. Now I just need to get this FreeRTOS+LwIP project going. Anyone who have tried?

    Thanks for a good blog post!

  156. September 21st, 2015 at 15:12 | #156

    @Mattias Norlander
    Hi Mattias.
    Taking the STM32F4Cube project made for the STM324xG_EVAL board is made for the DP83848 Phy chip but connected in the full MII mode, where you are only able to use the RMII mode with the breakout board and the STM32F4DISCOVERY board.
    As I did to this specific project, made in CooCox CoIDE, I changed the low-level Phy hardware drivers to match the reduced MII interface, so it could be used with the DISCOVERY board.

    If you are migrating the STM32F4Cube project to the DISCOVERY board you would have to do the same change in the low level driver parts.

    Good luck.

    Best regards
    Thomas Jespersen

  157. mohammad
    October 28th, 2015 at 10:44 | #157

    hi, i downloaded ur project, but it has 1 err,
    I cant fix it, the err is :
    colect2.exe : error :ld returned 1 exit status
    please help me, tnks.

  158. mohammad
    October 28th, 2015 at 13:47 | #158

    I fixed it, its really good

  159. MathieuCALDEIRA
    November 21st, 2015 at 22:44 | #159

    Hi guy’s

    Just for help the people who try to make pings:

    You need to add -DLWIP_ICMP=1 to your compiler flags or

    #define LWIP_ICMP 1

    You have to enable everything you need.
    Also i doesnt try dhcp but if you have problems wity that, check the lwip configuration (if dhcp is over udp, enable it)

    But…

    With prototypes wires like in the video, we get really bad pings. With the webpage you doest see how bad it is..

    Actually i do 140ms pings and i loose a lot of data..
    The mchdrv_poll is called in polling so it’s not a lwip problem

    With freertos +enc28j60 +stm32f407 i get pings around 1ms (with a delay of 1ms in the task who call mchdrv_poll) so lwip work fastly.

    Maybe the problems are around the wires, i will check it when i have some time ..
    I will also check the pll settings..

    I come back soon

  160. MathieuCALDEIRA
    November 21st, 2015 at 22:46 | #160

    Note : i will also check the schematic of discovery board, check if the pins are not used by something else

  161. Mathieu
    November 22nd, 2015 at 13:44 | #161

    I have made some changes to my circuit, and now i can ping at 1ms and it’s realy stable!!

    1/ Put the STM32f4Discovery on a proto board, and solder the cables, with the minimal length to the PHY board ! Proto cable (15cm) are bad !!!
    Consequence : Now the pings request are stable: 140ms everytimes and no packets lost ! (but ping stay too high ..)

    2/ I have remove the U5 component for see if it change something, result : It doesn’t reduce the high ping. So don’t remove U5

    3/ I have check the PLL settings: they are correct for the STM32F4Discovery board.

    4/ Remove the DEBUG in LWIP : The debug was using USART to transmit the printf(), it’s really slow!. (i have set LWIP_DEBUG to 0 but doesn’t realy work) so I have comment everything in stdio/printf.c at the function void PrintChar(char c)

    5/ Enjoy, now you can ping the board around 1ms (really stable)

    Another information :
    You need to set “1” in Ethernet/include/lwipopts.h at the line where is :
    #define LWIP_ICMP 1

    This is for enable ICMP (ping request for exemple)
    If you need to set something specific check the lwipopts.h file, or if that you search is not set, check the “opt.h” file but do the modification’s in the lwipopts.h file (witch is for user settings)

  162. stewie
    December 5th, 2015 at 01:47 | #162

    @Thomas Jespersen
    Hello Thomas Jespersen,

    I have been working on trying to port the STM324xG_EVAL Ethernet to STM32F407 for the STM32CubeMX. I have made some progress, but I cannot get it to work. I was wondering if you had a working example.

    Thanks

  163. tpd
  164. January 29th, 2016 at 14:27 | #164

    Hi TPD.
    This module is the exact same module as ours (please notice that the image is mirrored).
    So you should indeed be able to use this module and get the HTTP example working.
    Regards Thomas

  165. Marcelo
    March 2nd, 2016 at 14:42 | #165

    @mohammad
    How do you fix it? I have the same error: [cc] collect2.exe: error: ld returned 1 exit status
    when I tried to build the proyect

  166. Marcelo
    March 3rd, 2016 at 13:23 | #166

    Marcelo :
    @mohammad
    How do you fix it? I have the same error: [cc] collect2.exe: error: ld returned 1 exit status
    when I tried to build the proyect

    Sorry, now I read all the comments and I fixed it.

    I have problems with the ping command because I lose a lot of packets and the time of response is really high. I read that some people have the same problems, I will try to find a solution and tell how

  167. Salmen
    April 27th, 2016 at 21:20 | #167

    where I can find makefsdata.exe in the project folder

  168. April 28th, 2016 at 21:41 | #168

    @Salmen
    The ?makefsdata.exe? file is found inside the ?STM32F4x7_ETH_LwIP_V1.0.0UtilitiesThird_PartyPC_Software? folder.
    Please read more about how to make your own HTML files at the following page: http://www.aimagin.com/tgr/tgr12/amgf4connect/doc/HTML/index.html?webpage_configuration.htm

  169. Salmen
    April 30th, 2016 at 18:27 | #169

    do I open the project with keil uVision4,. if yes how to do that

  170. April 30th, 2016 at 18:41 | #170

    @Salmen
    No, the project is made for CooCox CoIDE.

  171. June 7th, 2016 at 10:11 | #171

    @Andy
    hi ,

    same probelm occur me in coocox 1.7.8 version , but there is no option to eselect Exclude from build option

  172. June 8th, 2016 at 15:58 | #172

    @rameshwar kakade
    Yes, they have removed the “Exclude from build” option in the latest versions.
    Instead you would manually have to remove the C-file from the project to remove it from the build to avoid the linker error.

  173. Vitaliy
    August 1st, 2016 at 15:37 | #173

    Hello! I am newbie! From Kazakhstan!
      my problem!
    [Cc] collect2.exe: error: ld returned 1 exit status
    help fix the problem.

  174. August 1st, 2016 at 16:02 | #174

    @Vitaliy
    You have to manually remove some of the webpage content C-files to avoid this linker error.
    Please read some of the comments above yours as the solution has already been explained.

  175. Jairo
    August 31st, 2016 at 21:32 | #175

    Hi Tomas,

    I downloaded your source and I compile in Coocox. But after software run, i receive repeating message on the debug serial “no active pcbstcp_slowtmr:”

    I could not understand. Does the hardware is right?

    I can test the hardware in some other way?

    Thank you

  176. September 16th, 2016 at 06:26 | #176

    @Jairo
    This sound like the External PHY has not been connected probably with the RMII interface, or at least that it does not seem to be able to communicate properly and regularly.
    Can you please check all connections and make sure that the wires between the processor and the Phy is not too long?

  177. emreist
    October 7th, 2016 at 17:19 | #177

    hey,
    i want to use http socket more than 4 or 5 sockets at the same time without http_connection_close. how can i arrange my code. ??

  178. mahdi
    January 29th, 2017 at 17:00 | #178

    hi how are
    thank you for your project
    i have problem with this
    1: i connected dp83848 to stmf4 discovery and see terminal for debug i recieved = tcp_slowtmr : no active pcbs?
    2: i connectes dp83848 and my pc to a modem ( have a router) but don?t get ip and MAC of dp83848?

    can you help me??

  179. February 9th, 2017 at 11:57 | #179

    @mahdi
    Hi Mahdi.

    Can you confirm that you have wired and connected the Ethernet Phy module correctly?
    Please notice that the cables can not be too long otherwise it will affect the connection due to induced noise between the signal wires.

    The error indicates that the STM32 is not able to communicate with the Phy over the RMII interface, or at least that it does not seem to be able to communicate properly and regularly.

  180. Tommaso
    February 23rd, 2017 at 14:04 | #180

    Hi at all,
    I confirm the setting:
    PHY_ADDRESS 0x00
    for the STM32F4-BB ( discovery with Ethernet Board ) use.

  181. Lobisomem
    March 30th, 2017 at 19:14 | #181

    Hi. I downloaded the coocox coide, downloaded the project but CooCox CoIDE does not open the project.

    Version downloaded:

    CooCox CoIDE
    Version: 2.0.6
    Build id: 20170117-2.0.6

    S.O.:Windows7 Professional.

    Other then download and unzip it, do I need to do something else to make CooCox open it?

    Thx

  182. March 31st, 2017 at 11:31 | #182

    @Lobisomem
    CooCox CoIDE have been undergoing tremendous changes throughout the past 3 years why this project is no longer supported.
    I am no longer using CoIDE as I mainly work with ST devices now, why I have decided to move to “System Workbench for STM32”.

  183. Lobisomem
    March 31st, 2017 at 13:50 | #183

    @Thomas Kølbæk Jespersen
    I see. So … do you have a link to download the project on System Workbench for STM32 ?

    thx again

  184. March 31st, 2017 at 20:42 | #184

    @Lobisomem
    I have not converted this project to System Workbench yet. So unfortunately there is no download link for the System Workbench project.

  185. Gedas
    April 5th, 2017 at 16:54 | #185

    @mohammad

    hello, how did u fix it?

  186. Gedas
    April 17th, 2017 at 21:30 | #186

    I cant make this thing working. I put library in the place, used pin layout from stm to PHY ,compiling, seems ok, but i can’t reach http. What’s the problem. All the leds in PHY blinking perfectly. My router doest seems to see the device

  187. ABVF
    April 20th, 2017 at 15:28 | #187

    @mohammad
    How did you fixed the error?
    [cc] collect2.exe: error: ld returned 1 exit status

  188. Alex
    September 14th, 2017 at 15:26 | #188

    @ABVF
    You have to exclude the fsdata.c from compile. You can read another comment from Thomas himself explaining this above at the initials comments.
    I hope that I could help.

  189. Alex
    September 20th, 2017 at 21:10 | #189

    Congrats, Thomas!! You did a great job here!!
    I’d like to tell my issues with the project here for futures developers:
    *First of all, if you are getting problems to ping your PHY, please reduce your cables to 5cm. Your freq is really high and interference is something real to kill your tests (lol)
    *If you’re having problems at compile, make sure that your fsdata.c is out of your project to compile. You can find this file at “Ethernet/src”.
    *Try to use Static IP for initials tests so, comment the line with #define USE_DHCP in main.c file. It will be a lot easier if your make a direct connection to your computer form your device and watch what is happening with the connection with Wireshark.

    Hope this could be helpful.
    Regards,
    Alex

  190. September 20th, 2017 at 22:24 | #190

    @Alex
    Thanks for your help and suggestions Alex. I have added your hints to the bottom of the blog-post.

  1. October 2nd, 2012 at 13:35 | #1