Skip to main content
Graduate
May 15, 2023
Solved

LwIP up-to-date examples

  • May 15, 2023
  • 5 replies
  • 12702 views

The examples and documentation provided with STM32CubeIDE are dated year 2015. Is there any repository with current versions examples? Could ST provide within STM32CubeIDE up-to-date examples?

I searched dozens of links into this forum and I am not able neither to find a decent LwIP RAW (NOSYS) example to be based on.

The most similar example is LwIP_TCP_Echo_Server, which is a bad example. In no way the application is manipulating the received data and showing how to send back a reply properly. At the very moment the data is received, the same pbuf is sent. This is by no way an approach to a decent application in which to be based to develop anything. The example is useless and obsolete to be used in any current STM32CubeIDE.

LwIP configuration has lots of parametres with very short description of them (indeed, it's the same created doxygen inline documentation). Can ST provide an updated AN on how to use LwIP (RAW and RTOS) with STM32? The UM1713 is out of date and confusing to develop using current STM32CubeIDE versions.

    This topic has been closed for replies.
    Best answer by MWB_CHa

    Hi @JMarq.1​ 

    • Sure, for STM32F207 you will not find ioc or CubeIDE support since it is an older series
    • For STM32H7, there is no support currently for ioc or CubeIDE on LwIP examples. The support of ioc and CubeIDE in TCP/IP stack was performed on X-CUBE-AZRTOS-H7. But I understand that NetXDuo doesn't seem to be a good fit for you.
    • Regarding the examples: as explained before, we try to provide the simplest possible code allowing everyone to customize and adapt to their needs. So data processing is not part of the example but it's part of what you shall add at applicative level. But I agree, we can enhance the example to be closed to realistic buffers usage.
    • Update for LwIP V2.1.3 is ongoing, but for older series like STM32F2 and STM32F4 it is not planned in the near future.

    I hope it helps.

    5 replies

    ST Employee
    May 19, 2023

    Hi @JMarq.1​ ,

    I'm not sure I fully understand the problem but let me try provide some clues:

    Regarding the point that examples are too basic or not realistic enough:

    We usually provide two sets of examples:

    • Basic examples allowing new users to understand the IP and the firmware and build their own applications (ie. Echo Client/Server example)
    • Advanced examples showing almost a real applicative use case and using multiple resources (ie. WebServer example)

    It is then up to you to use or customize the examples based on your needs and constraints.

    I hope it helps.

    Kind Regards,

    JMarq.1Author
    Graduate
    May 22, 2023

    Hi @MWB_CHa​ 

    Regarding the clues you provided:

    · I'm trying it on a NUCLEO-F207ZG.

    · As you pointed, H7 package has STM32CubeIDE projects, but no .ioc file provided (what about LwIP configuration? Should I look for them in lwipopts.h?)

    I had a look inside F2 and F4 packages. None of them include any STM32CudeIDE sample. All of them are SW4STM32 (this is what am I refering as out-of-date). I.e.: currently using STM32CubeIDE you need to use MX_LWIP_Process(); instead of ethernetif_input(&gnetif); sys_check_timeouts();.

    · Azure RTOS examples are not suitable as NOSYS RAW examples

    Regading the sets of examples you mention:

    · Echo server example simply sends the same pbuf back to he client using the same LwIP buffer where incoming data is arriving. It might be a more realistic example some treatment before sending data to the client (i.e. count how many spaces are there in the received text and send back a message telling this counter to the client). I feel this would clarify how to get incoming data, how to treat it in application buffers, and how to work out an answer based on incoming data to send it to the client. This is a more realistic scenario than simply using the same pointer from the incoming data as buffer to send data to the client.

    · Besides, in echo server example I'm not sure you can send back ptr->payload without risk of dupplicating any chunk of bytes in the answer. I read somewhere that it is better to use pbuf_copy_partial.

    Anyway, I do understand that LwIP is open-source and free, so is STM32CubeIDE, but as it is (or was) the provided stack included in the IDE, it would be great to get more elaborated documentation about this library (how to configure it, suggestions, etc.) and up to date samples that can be opened directly on current versions of STM32CubeIDE. It would be nice at least. Also it would be good to keep up to date the library on new releases (current version is 2.1.3 vs 2.0.3 provided for F2 & F4 series).

    Thanks

    MWB_CHaAnswer
    ST Employee
    May 26, 2023

    Hi @JMarq.1​ 

    • Sure, for STM32F207 you will not find ioc or CubeIDE support since it is an older series
    • For STM32H7, there is no support currently for ioc or CubeIDE on LwIP examples. The support of ioc and CubeIDE in TCP/IP stack was performed on X-CUBE-AZRTOS-H7. But I understand that NetXDuo doesn't seem to be a good fit for you.
    • Regarding the examples: as explained before, we try to provide the simplest possible code allowing everyone to customize and adapt to their needs. So data processing is not part of the example but it's part of what you shall add at applicative level. But I agree, we can enhance the example to be closed to realistic buffers usage.
    • Update for LwIP V2.1.3 is ongoing, but for older series like STM32F2 and STM32F4 it is not planned in the near future.

    I hope it helps.

    JMarq.1Author
    Graduate
    May 29, 2023

    Hi @MWB_CHa​ 

    Thanks for your answer. OK, I looked into "official" LwIP examples and they provide the same examples like ST more or less, no additional help:

    http://download.savannah.nongnu.org/releases/lwip/ (contrib- files)

    I see what is the scenario now. Nonetheless, in my opinion, people who are buying current hardware (NUCLEO F207 boards) should have the opportunity to have up-to-date examples in current IDE versions.

    Anyway, I close the ticket. Thanks

    Graduate
    June 20, 2023

    Hi @JMarq.1 I totally agree!

    We spent money buying this hardware and we want to have the same resource access than the other customers when they are buying other stm32 devices. I have lost a lot of time migrating examples to CubeIDE and several times this process has some erratic behavior, probably bugs.

    Now they are saying that we will never find any CubeIde based example because they are older devices. This is a "great" new. 

    If we customize and we adapt those older examples to our product we will have an application based on freeRTOS cmsis1 insetad of cmsis2 versions and so on with the drivers files versions. But the most unconfortable thing: we can not use CubeMX for updating configurations options with this tool. The "import project" result has nothing to see with the CubeIDE project structure. This makes very difficult to mix code from news project to this demos based projects. It also makes difficult demo porting parts from demo code to your papplication project created with CubeMx.  

    I was creating a project from CubeIDE adding FreeRTOS with cmsis2. When I tried to use the ethernet comms with echoserver from demo here, it was a nightmare for compilation. I had to remove cmsis2 files and some system file and adding older versions of some files in order to get the compilation errors free.

    This is an useless lost of time and it adds a lots of "non garantee" of desired functionality behavior when executed.

     

     

    Graduate II
    June 20, 2023

    Hi, may not be the answer for your question, but i felt you are in a path i followed for developing lwip app, reading a lot of ref, suspecting my board. but surprisingly, this recent example ( https://stcommunity.st.com/t5/stm32-mcus/how-to-create-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308/show-comments/true#comment-on-this ) heped me in getting decent performance with LWIP UDP/TCP appliations (without OS).