cancel
Showing results for 
Search instead for 
Did you mean: 

how to prevent the Lwip stack from shutting down after few transmissions in STM32?

SSRIN.1
Associate III

I am currently writing a code to send joystick data from a PC to an STM32 Nucleo board. I use pygame to read joystick values and use the socket library of python to send data to MCU via a router. Both MCU and PC is connected to the router. On the MCU side, I use a modified example code of LWIP given in STM32 Cube pkg. The MCU also runs a FreeRTOS scheduler on which LWIP is running. I was able to get it run flawlessly in a 2 threaded FreeRTOS code. However, when I shift the code to a 16 threaded code[main project], LWIP stops working after a few exchanges. In a sense, I don't receive any ping after 4-5 exchanges.

Some things that were experimented with to resolve the issue

  1. reduced the publishing frequency from the PC side to 20hz. This increases the exchange duration but fails after few minutes.
  2. Tried reducing the ConfigMaxPriority parameter of FreeRTOS config from 56(cube ide default) to 16.[Operating time increased]
  3. tried changing FreeRTOS main heap memory and LWIP thread stack memory [no difference]

I think, its a memory issue. But not sure how to resolve. can anyone advice me on this ?

1 ACCEPTED SOLUTION

Accepted Solutions

I was able to resolve this by downgrading to CMSIS v1

View solution in original post

7 REPLIES 7
SSRIN.1
Associate III

Update 1: I tried to find out heap utilisation with xPortGetFreeHeapSize() . When the ping stops , it still shows 35kb of unused memory.

SSRIN.1
Associate III

Update 2 : The code is stuck at a free RTOS assert function

configassert( pxqueue- uxitemsize == 0 )

Hello @SSRIN.1​ ,

You could perform a stack analysis or activate stack overflow detection in your RTOS in order to rule out a stack issue.

Please refer to this reference which may help you.

BeST Regards,

Walid

I was able to resolve this by downgrading to CMSIS v1

Hello @SSRIN.1​ ,

Good news! Thanks for sharing this.

Can you tell us which version of CMSIS is causing the problem?

BeST Regards,

Walid

CMSIS V2

Sorry, I didn't explain my question well.

Could you provide the Device Version Number given in the following file: (path: Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f4xx.h)

Example :

/**

* @brief CMSIS Device version number V4.3.3

*/

Thanks in advance.

BeST Regards,

Walid