Skip to content

How to configure LAN8720 RMII Ethernet on STM32F407VET6? #957

Open

Description

@c0ncua109

Hi,

I am trying to use grblHAL STM32F4xx with:

  • STM32F407VET6
  • LAN8720 PHY
  • RMII interface
  • STM32CubeIDE

I would like to enable Ethernet support and use networking features such as Telnet/WebUI.

I have some questions:

  1. Which board configuration should I start from for STM32F407VET6?
  2. How do I enable lwIP and Ethernet correctly?
  3. How should LAN8720 PHY be configured?
  4. Is there an example configuration for RMII + LAN8720?
  5. Which files should be modified?
  6. Is an external 50MHz clock required for REF_CLK?
  7. Are there any example projects using LAN8720 with STM32F407?

Currently I can build the project, but Ethernet is not working yet.

Thanks!

Activity

  1. c0ncua109 commented on May 20, 2026

    @c0ncua109
    Author

    I already tried enabling Ethernet by changing:

    #define ETHERNET_ENABLE 1
    
    but the project fails to build.
    
    ../Src/enet.c:33:10: fatal error: lwip.h: No such file or directory
    33 | #include "lwip.h"
  2. terjeio commented on May 20, 2026

    @terjeio
    Contributor
    1. stm32f407vet6_dev_board.h - Ethernet is working for this board, with a DP83848 PHY
    2. - 7. A driver is required for the LAN8720 PHY, not sure if one is provided by ST. The schematic for dev board mentioned above could be a pointer, perhaps also the schematic for the Nucleo F756ZG dev board which uses a LAN8742 PHY.

    The reason it failed to build is likely that the project is not set up to include the necessary parts - the Debug F407 25MHz ETH build configuration is (for the DP83848 PHY).

  3. c0ncua109 commented on May 20, 2026

    @c0ncua109
    Author

    LAN8720 is basically a lower-cost variant of the LAN8742 and they are largely register-compatible for RMII operation.

    What would be the correct way to build grblHAL using the existing LAN8742 Ethernet configuration?

    Should I just use the existing Debug F407 25MHz ETH build configuration and keep the same PHY driver setup, only changing the PHY address if required?

    My hardware is STM32F407VET6 + LAN8720 in RMII mode.

  4. terjeio commented on May 20, 2026

    @terjeio
    Contributor

    You have to get (or write) a LAN8720 driver and create a build configuration using it. Copy this and change the two last include paths:

    Image

    Perhaps the F7 LAN8742 can be used as-is or as a base if no driver is available for the F4. To check if a driver is available previously I added a new project and edited the .ioc file - but the latest IDE version tell me to install stm32cubeMX to do so, which I have not done yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions