cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx NO_SYS/With_RTOS option problem with lwip and FREERTOS

JimSChen.4
Associate II

Hello,

This question has been asked several times but I have to raise it again since no solid answer so far and I am stuck!

My configurations:

stm32h745ZI-Q Nucleo-144 board.

CubeMx ver5.6.1

CubeIDE ver1.4.1

lwip 2.1.2 with mqtt client

freeRTOS 10.2.1

Why in cubeMX, even I selected using FREERTOS for both core, the "WITH_RTOS (Use FREERTOS ** CubeMX specific **)" in lwip -> tab "General Settings -> RTOS dependency" is greyed out and the default is Disabled?

Also I cannot change "NO_SYS (OS Awarness)" from "OS not used" to something like "OS used" in tab "Key Optioins -> Infrastructure - OS awareness option"?

Basically I want to use FREERTOS with lwip and mqtt but the cubeMX won't allow me to do that?

Is this a bug or cubeMX hasn't implemented generating the code with NO_SYS = 0 yet?

I can possibly tweak the lwip_conf.ftl file to just make it work but I am not sure that's adequate?

Can experts or STM developers point out a solution please?

Thanks,

Jim

6 REPLIES 6
JimSChen.4
Associate II

Can anybody from STM32 give a hint on this please? Or simply say yes or no. Thanks

JimSChen.4
Associate II

OK, after some diggings, link https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32 and its links to other articles explain some hints thanks to @Piranha​ 's post.

So to date, stm32cubeMX cannot use NO_SYS=0, i.e. WITH_RTOS has to be disabled. Hopefully one day, cubeMX can provide this option and generate proper stack, thread safe prototype codes.

For me, it is still fine to just use tcp_raw calls with mqtt inside one FreeRTOS task although I have to work around the heap issue.

Piranha
Chief II

There is something wrong with your CubeMX settings. I tried it on version 6.0.0 - when FreeRTOS is enabled for the respective CPU core, the "NO_SYS (OS Awarness)" setting automatically changes from "OS Not Used" to "OS Used" like you wished. :)

You've probably found it already, but, if not, take a look on alister's topic also:

https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet

JimSChen.4
Associate II

Thanks Piranha. I don't know what went wrong with my CubeMX. It is version 5.6.1 whilst the embedded in CubeIDE is 6.0.0. Both the same. Even when I build a project from scratch, those options are still greyed out. No idea!

Anyway, since I am using mqtt client came with LwIP and it uses tcpip_raw anyway so I have to stick to the single task for lwip/mqtt.

I had a look of alister's Ethernet bug fix version and compared with what STM provides. There are a number of differences. Yet my app which built from cubeMX generated code works quite well, apart from the heap pointer returned from _sbrk wasn't right. So I haven't used his code so far. Maybe STM has changed since. I will give it a go to see whether it can pass the long term stability tests then decide.

JimSChen.4
Associate II

I have finally figure out the quirks why cubeMX not allows to change the NO_SYS option for STM32H745 (maybe others as well). It may have a reason but hope STM can improve or at least explain clearly.

  1. If System Core -> CORTEX_M7 -> CPU DCache is disabled, NO_SYS is always OS Not Used.
  2. Even when above (DCache) is enabled plus Middleware -> FREERTOS_M7/M4 is set, if Middleware -> LWIP selected for both Cortex-M7 and Cortex-M4, NO_SYS is always OS Not Used. Can't change!
  3. Only DCache is enabled, FreeRTOS is set, ETH is set, and LWIP only selected for M7, NO_SYS will be OS Used or follow the FreeRTOS selection.

Strange enough, if DCache is disabled, LWIP cannot be enabled until both Cortex-M7 and Cortex-M4 are selected! I don't understand the logic behind it. Maybe STM can explain.

The side effect is, after enabling OS Used, my mqtt cannot connect any more, always timeout by tcpip_trhead! Not sure anybody has ever run mqtt (lwip 2.1.2) with RTOS (10.2.1) successfully with cubeMX (6.0.1) generated code?

I am using STM32Cube_FW_H7_V1.8.0.

I have the same problem and found the same result you found 4 years ago.

I am using STM32Cube FW_H7 v1.11.2 on a custom board of H757.

Dcache enabled, FreeRTOS enabled, ETH configured,

But the problem is: LWIP cannot be enabled with ONLY M7

If both cores are selected to enable LWIP, NO_SYS is "OS Not used". 

How long will ST solve this problem ?