Skip to main content
Raymond Buck
Senior
March 15, 2017
Question

CubeMX LWIP not working

  • March 15, 2017
  • 18 replies
  • 4330 views
Posted on March 15, 2017 at 02:47

I have just started experimenting with ST products. I have a STM32F4 Discovery board. I bought a DP83848 PHY on Ebay and connected it to the Discovery board. I downloaded a hex file from here:[

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fblog.tkjelectronics.dk%2F2012%2F08%2Fethernet-on-stm32f4discovery-using-external-phy%2F

]

I am able to ping the board and access the web page with no issues.

I then used CubeMX to create a project with nothing but LWIP and two GPIO pins. I figured I would start out simple. The goal was to see if I could get LWIP working. I generated the code and imported it into System Workbench and used STLink to program the board.

I cannot ping the board (I enabled ICMP in CubeMX) and it does not make a DHCP request. I know the request is not being made because Wireshark never sees it.

Do I have to put anything in the main() while loop for lwip to work? Do I need to make any modifications to use the DP83848? I noticed in CubeMX that in the Ethernet Settings, it states LAN8742A for the PHY. Maybe this is my issue? If so, what modifications need to be made to tell CubeMX to use the DP83848?

I have been working on this for two days and making zero progress.

    This topic has been closed for replies.

    18 replies

    ST Technical Moderator
    March 15, 2017
    Posted on March 15, 2017 at 11:20

    Hello,

    Welcome to our Community.

    You'll probably want to review LwIP examples as you can find in the STM32CubeF4 package:

    STM32Cube_FW_F4_V1.15.0\Projects\STM324x9I_EVAL\Applications\LwIP

    Looking to the available examples and these documents can help you a lot to go further in your application:

    -

    http://www.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM00104712.pdf/files/DM00104712.pdf/jcr:content/translations/en.DM00104712.pdf

     for the STM32CubeMX use in the LwIP section.

    -

    http://www.st.com/content/ccc/resource/technical/document/user_manual/79/6e/5f/d4/5c/25/43/96/DM00103145.pdf/files/DM00103145.pdf/jcr:content/translations/en.DM00103145.pdf

     STM32Cube Ethernet IAP example: it maybe helpful as it provides a full description of how to implement In-Application Programming (IAP) using Ethernet communication.

    -

    http://www.st.com/content/ccc/resource/technical/document/application_note/fd/5d/64/cf/7c/38/4c/30/DM00036052.pdf/files/DM00036052.pdf/jcr:content/translations/en.DM00036052.pdf

    ' LwIP TCP/IP stack demonstration for STM32F4x7 microcontrollers� .

    -

    http://www.st.com/content/ccc/resource/technical/document/user_manual/65/e8/20/db/16/36/45/f7/DM00103685.pdf/files/DM00103685.pdf/jcr:content/translations/en.DM00103685.pdf

    “Developing applications on STM32Cube with LwIP TCP/IP stack'. 

    Hope this helps you.

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    Raymond Buck
    Senior
    March 15, 2017
    Posted on March 15, 2017 at 17:55

    Thanks Imen. I have already read UM1718 and UM1709. I just skimmed through UM1709 as I had no need for IAP. I will review the other two and see if they can help me.

    Ray

    Raymond Buck
    Senior
    March 15, 2017
    Posted on March 15, 2017 at 22:07

    I have made some progress, but not much. I changed the ♯ define IS_ETH_PHY_ADDRESS(ADDRESS) in stm32f4xx_hal_eth.h from 0x20U to 0x01U to match the DP83848. Now when I start the board Wireshark sees this:

    256    130.602404    0.0.0.0    255.255.255.255    DHCP    350    DHCP Discover - Transaction ID 0x5851f42d

    257    130.604782    44:8a:5b:d3:4c:8b    Broadcast    ARP    60    Who has 172.16.1.107?  Tell 172.16.1.1

    258    130.604782    44:8a:5b:d3:4c:8b    Broadcast    ARP    60    Who has 172.16.1.107?  Tell 172.16.1.1

    172.16.1.107 was cached in the DHCP lease tables. My guess it that in some of my testing, the DHCP server did manage to see the board and assign it an IP address. The MAC address in the DHCP table is 00:80:e1:00:00:00 which is what CubeMX assigned to the board.

    If I remove the 172.16.1.107 entry from the DHCP table and plug the board in, Wireshark only sees this:

    347    0.000000    0.0.0.0    255.255.255.255    DHCP    350    DHCP Discover - Transaction ID 0x5851f42d

    So apparently the board isn't making a DHCP request, but the server(172.16.1.1) is able to see the MAC address???

    I don't know what else needs to be changed to let the stack know I am using a DP83848 instead of a LAN8742A PHY device. Can anyone tell me what else should be changed?

    dieter 123
    Associate III
    November 10, 2017
    Posted on November 10, 2017 at 13:22

    Hi

    How does it come ST is not fixing this issue:

    Bug description:

    1. start FW with ethernet disconnected

    2. wait for 10 secnds

    3. plug ethernet cable

    4. ping board

    -> board wont reply to ping.

    I am using the latest CUBE and F4 repository.

    What is the recommended fix here?

    Thx

    Barber.Mark
    Associate III
    August 15, 2018

    yes i am having the same problem if the cable disconnects then there is no recovery. i am thinking monitor the cable connection if i disconnects release the IP address then try to renew. i cannot be the only one with this trouble. tanks any help appreciated.