cancel
Showing results for 
Search instead for 
Did you mean: 

Lwip is not working in CMSIS_V2

spate.2
Associate III

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.

13 REPLIES 13

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. 

A_Fresh_Lad
Associate

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 :)

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
Lead

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.