Skip to main content
Explorer II
October 8, 2025
Question

sample project for LWIP ethernet code on STM32F765IIT ?

  • October 8, 2025
  • 4 replies
  • 427 views

HI,
I am currently working on an Ethernet project using STM32F765IIT with the LwIP stack .
I have configured the MAC and PHY (DP83848/DP83842) in MII mode, and link status is active.
Now I want to verify Ethernet communication by implementing the ping (ICMP Echo Reply) functionality.

Could anyone please share:

  • Example code or reference project for STM32F765IIT + LwIP that handles ICMP Echo requests (ping)?
  • Or guidance on how to properly configure LwIP for responding to ping commands?

My setup:

  • MCU: STM32F765IIT
  • Interface: MII (PHY: DP83842)
  • Toolchain: STM32CubeIDE
  • CubeMX: Ethernet + LwIP (no RTOS)

Any working example, configuration tips, or LwIP settings related to ping would be greatly appreciated.

Thank you,
Sreerag

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    October 8, 2025

    Hello @SREERAG and welcome to ST Community!

    Could you explain exactly what you configured in your project? Please provide an IOC file if possible. For the application to work correctly, you need to configure the Memory Protection Unit (MPU) for the memory sections used to store Tx/Rx descriptors and buffers and LWIP MEM_SIZE. You can follow the guide below, skip the FreeRTOS section, and just add MX_LWIP_Process() inside your while loop to poll for packets.

    Feel free to ask questions if you get stuck. I’ll be happy to help.

    Best regards,

    SREERAGAuthor
    Explorer II
    October 9, 2025

    Hello @STackPointer64,

    Thank you for your response.

    In my project, I’m using STM32F765IIT custom board with DP83842 PHY in MII mode.
    The setup is created using STM32CubeMX + STM32CubeIDE, with Ethernet + LwIP, but without FreeRTOS (bare-metal mode).

    My goal is only to make ping (ICMP Echo) communication work, to verify the Ethernet interface.
    Currently, the PHY link is up, but I don’t receive any ping replies from the MCU.

    Could you please confirm:

    1. What are the required MPU and memory configurations when using LwIP without FreeRTOS?
    2. Whether I only need to call MX_LWIP_Process() in the main loop to handle incoming packets?
    3. Any reference example or IOC configuration for STM32F765 + MII + LwIP (no RTOS) would be very helpful.

    Thank you for your guidance.

    Best regards,
    Sreerag

    Technical Moderator
    October 9, 2025

    Hello @SREERAG,

    1- MPU and memory configuration are the same for baremetal LwIP and LwIP + FreeRTOS; just follow the guide.

    2- There are only two functions to call: MX_LwIP_Init(), which is added automatically when you enable LwIP in your project, and MX_LWIP_Process(), which keeps polling for incoming packets and link status.

    3- I've attached an example IOC configuration below. You still need to make the proper adjustments to the linker script as mentioned in the article.

    Best regards,

    Super User
    October 8, 2025

    Have you seen this? for a slightly different F7:

     https://github.com/stm32-hotspot/CKB-LwIP-FreeRTOS-UDP-Echo-Server-F767

     

    Graduate
    October 9, 2025

    Hi Sreerag,

    I can offer a suggestion for a working project you can use as a reference.

    You can take a look at this project which is for a very similar board (STM32F756ZG). It uses the Mongoose Networking Library, a lightweight library designed for embedded systems with support for LwIP. Even though you're looking for a bare-metal example (and this one uses FreeRTOS instead), you can use this as a reference for a complex HTTP webserver powered by LwIP  featuring a device dashboard. Also, you can take a look at the hardware setup in the .ioc file, since the configuration for the clocks, and Ethernet pins might be very similar to your board.

    Heads up: I am part of the Mongoose development team and I hope this helps you get started!

    Technical Moderator
    October 9, 2025

    The IOC is for STM32F767ZI so I could test it on the Nucleo board. But fear not, because STM32F767ZI and STM32F765 share the same architecture. You only need to copy the MPU and LwIP configuration to your project.

    Could you please confirm? Any reference example or IOC configuration for STM32F765IIT + MII + LwIP (no RTOS) would be very helpful.

    As there are many MCUs with different packages, there isn't an example for each one. One suffices since they share the same architecture. Nonetheless, I attached a newly created IOC for the MCU you are using.