Skip to main content
spate.2
Associate III
April 20, 2023
Question

Lwip is not working in CMSIS_V2

  • April 20, 2023
  • 15 replies
  • 5021 views

I am using stm32f756zg. In which i configure LWIP with FREERTOS cmsisv2. I am getting hard faults when ping devices from other devices.

It works fine when I change FREERTOS cmsis v1 and increase the default task stake.

15 replies

ST Technical Moderator
April 20, 2023

Hello @spate.2​ and welcome to the Community :)

Please have a look at this article: How to create project for STM32H7 with Ethernet and LwIP stack working.

I advise you to check this post: how-to-make-ethernet-and-lwip-working-on-stm32

Hope this help 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
spate.2
spate.2Author
Associate III
April 20, 2023

@Imen DAHMEN​ 

I go through the first article which you suggested and found that that article uses FREERTOS CMSIS V1. But I want to make it work with FREERTOS CMSIS V2.

I am checking this post https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32.

ST Technical Moderator
April 20, 2023

Please provide more details on your case in order to be able to help you.

Can you please share the steps and scenario that you follow, and which tools are used (CubeMx, IDE)?

Make sure to use the latest version of tools and software.

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
spate.2
spate.2Author
Associate III
April 20, 2023

I am using STM32CUBEIDE 1.12.0.

Scenario: I want to create a TCP server with FREERTOS CMSISV2.

Steps that i follow,

Step 1: configure ethernet.


_legacyfs_online_stmicro_images_0693W00000biUtgQAE.pngStep 2: freertos configuration


_legacyfs_online_stmicro_images_0693W00000biUu5QAE.png
_legacyfs_online_stmicro_images_0693W00000biUuAQAU.png
_legacyfs_online_stmicro_images_0693W00000biUqEQAU.pngStep 3: LWIP configuration.


_legacyfs_online_stmicro_images_0693W00000biUuFQAU.png
_legacyfs_online_stmicro_images_0693W00000biUuPQAU.png
_legacyfs_online_stmicro_images_0693W00000biUuZQAU.png
_legacyfs_online_stmicro_images_0693W00000biUujQAE.png 

Step 4:coretex m7 configuration.


_legacyfs_online_stmicro_images_0693W00000biUv8QAE.png 

ST Technical Moderator
April 20, 2023

Please make sure to use latest version of STM32CubeMX v6.8 and x-cube-freertos v1.0.1, as it may be due to the known issue with previous version of x-cube-freertos pack which is already fixed on the latest version.

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
spate.2
spate.2Author
Associate III
April 21, 2023

@Imen DAHMEN​ 

Thanks for your response.

I would able to find a version of STM32CubeMX which is V6.8. But I would not able to find a version of x-cube-freertos. Can you please help me to find it?

spate.2
spate.2Author
Associate III
April 21, 2023

@Imen DAHMEN​ 

I am using the following version of freeRtos.


_legacyfs_online_stmicro_images_0693W00000biYheQAE.png

ST Technical Moderator
April 24, 2023

You can check the pack version in the "Software Packs"


_legacyfs_online_stmicro_images_0693W00000bigSSQAY.png 


_legacyfs_online_stmicro_images_0693W00000bigUJQAY.png

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
spate.2
spate.2Author
Associate III
April 25, 2023

Thanks @Imen DAHMEN​ ,

I checked x-cube-freertos version which is v1.0.1.Although it is not working.

TWard.1
Associate II
November 4, 2024

same problem here.  I get DMA errors on V2, and packet corruption on V1!

freeRTOS 10.3.1, CMSIS-RTOS 2.00.

STM32H743ZIT6 - STMH7 1.11.2

STM32CubeIDE 1.16.1

I see a warning in software saying I should updata CMSIS, but I have the latest H7 firmware available installed already. 

Visitor II
January 19, 2025

Had the same problem on stm32f767 trying to use LWIP with CMSISv2. I narrowed the problem down to erroneous data being written to the "TxPktSemaphore" Semaphores being used by the LWIP library. Turns out its because the assigned stack for the tasks are overflowing and writing into other areas of memory. All over the LWIP code the difference between the task size in words and in bytes is muddled. For example in the configurator I've chosen 1024 words as TCPIP_THREAD_STACKSIZE:

A_Fresh_Lad_0-1737325742078.png

but in the code its actually 1024 bytes:

A_Fresh_Lad_1-1737325797821.png

This seems to be a none issue for the tcpip thread, as they seem to have already set the default value to 1024 to account for it actually being bytes, but they seem to have forgotten to do this for INTERFACE_THREAD_STACK_SIZE in ethernetif.c. I manually added a * 4 shown below and it fixed the problems:

A_Fresh_Lad_2-1737325964127.png

Hope this helps :)

Visitor II
January 19, 2025

Oh and fyi for anyone with the same chip, you also want to:
#undef LWIP_RAM_HEAP_POINTER in lwipopts.h

- Increase the stack size of the default task in the FREERTOS settings, I set mine 512 words, you might be able to get away with less by experimenting

- Change the thread priorities because the default values were valid for CMSIS v1. Heres what I chose:

A_Fresh_Lad_0-1737326845872.png

- Probably also increase your FREERTOS heap size

 

alister
Senior III
January 20, 2025

Very likely the same problem and fix I'd posted at https://community.st.com/t5/stm32cubemx-mcus/bugs-caveats-misc-fixes-stm32h7s-cube/td-p/710992. Refer the lwIP list of problems.