cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP DHCP request not working on STM32F7

KSchu.1643
Associate II

Hi all,

I am trying to get LwIP running on my STM32F769I-Discovery board. It works fine with the provided netconn-example.

But when I try to generate a new project inside CubeIDE the dhcp-discovery is always failing. I can not see anything when running my code using Wireshark.

Can anybody provide me a working example based on a project generate from a recent CubeMX version? Unfortunately I failed to integrate the provided example into my CubeIDE project.

@ST: When will you update your examples and integrate them into CubeIDE?

Thanks

Klaas

5 REPLIES 5
KSchu.1643
Associate II

Maybe it helps if I add my project...

Piranha
Chief II

> working example based on a project generate from a ... CubeMX

Without rewriting that is impossible, because CubeMX generates non-working bloatware.

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

But there are still several critical bugs to report, especially related to Cortex-M7, and ST's DHCP and netif up/down usage most likely is also broken.

Arno1
Senior

Hello Klaas,

I'm currently working with the same board and I've got it working using CubeMx 5.4.0.

I also use AC6 System Workbench for IDE.

I use dnsmasq to run a DHCP server and the board and my laptop are connected through a switch (to prevent dnsmasq to go to some sort of sleep mode).

use

$ netcat -lu4 54321

to listen to the UDP packets

Regards,

Arno

KSchu.1643
Associate II

Hi Arno,

thanks for that. Maybe I should think about switching to AC6SW as well. CubeIDE seems to be to buggy...

Thanks

Klaas

Frederic Cloth
Associate III

Hi,

I presume you aren't anymore searching for an answer, but others like me might do. Here it is:

When you do activate the DHCP option on the CubeIDE software, it indeed changes the code to use DHCP... and... disable it !

How clever are those who have made such a tool... Amazing ! :-))

You have to manually insert

#define USE_DHCP

in the main.h file in order that the DHCP is used. If you do that, it works (at least it did for me).

By the way, if you use a static address instead of DHCP and you enter the IP address, mask and gateway in the IDE/cube interface... it doesn't work as well (how surprising !) and you have to set it manually in the code:

in the file LWIP/App/lwip.c, replace

uint8_t IP_ADDRESS[4];

uint8_t NETMASK_ADDRESS[4];

uint8_t GATEWAY_ADDRESS[4];

by

uint8_t IP_ADDRESS[4]={192,168,1,201};

uint8_t NETMASK_ADDRESS[4]={255,255,255,0};

uint8_t GATEWAY_ADDRESS[4]={192,168,1,1};

there as well... it works (you have to redo it everytime you open the cube editor as it regenerate the code... without the IP :-)) )

I honnestly can't understand why they can't/don't fix those problems (because I guess almost everybody runs into them) or at least document the workarounds or if this is a feature, explain why it needs to be like that.

This is a bit sickening to loose a few days of your life looking for a solution to those trivial problems and likely turns many people away from developing products with STM.