Skip to main content
Mz.1
Associate III
September 7, 2023
Solved

LWIP - udp_new() returns PCB as NULL

  • September 7, 2023
  • 2 replies
  • 3358 views

Hi,

I decided to upgrade my STM32CubeMX to the latest version 6.9.1.

my project was generated first with STM32CubeMX 6.5.0 - so I had to copy the IOC manually.

I checked multiple times that all configuration is the same like it was, and it is.

 

when I'm calling the LWIP method udp_new() I'm getting NULL and than I can't send any UDP message.

I did a debug and notice this is happening under "do_memp_malloc_pool" function in the memp.c file

 

this is not happening in the old code generation.

 

it there special configuration that I'm not aware of?

 

thanks for the help!

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

Don't know about Cube, but in some *opt.h file you can set the maximum number of UDP PCBs, have you checked that?

Do you get this error already on the first udp_new() ?

And depending on STM32 you have to take care where in the SRAM the lwip memory pool is placed.
That definitely applies to the H7.

2 replies

LCE
LCEBest answer
Principal II
September 8, 2023

Don't know about Cube, but in some *opt.h file you can set the maximum number of UDP PCBs, have you checked that?

Do you get this error already on the first udp_new() ?

And depending on STM32 you have to take care where in the SRAM the lwip memory pool is placed.
That definitely applies to the H7.

Mz.1
Mz.1Author
Associate III
September 10, 2023

@LCE thanks for your reply :)

Don't know about Cube, but in some *opt.h file you can set the maximum number of UDP PCBs, have you checked that? yes it set to 4

> Do you get this error already on the first udp_new() ? yes on the first

 

Pavel A.
Super User
September 10, 2023

Debug. Go into udp_new().