cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP not completing the DORA-DHCP schedule

GStou
Associate III

Added "DHCP" in the title to give the context.

Using an STM32H7S78-DK I try to set up the network to join an IPv4 network through DHCP.

I did set up the board using CubeMX, standard configuration, MPU activated.

FreeRTOS + LwIP

Removed all other interfaces I don't need.

Made sure the Ethernet clock shows 50MHz

The LED's on the RJ45 start to blink (Orange LED blinks with packets exchanged)

but I get no IP address.

digging in the possibilities I added a simple routine to monitor the DHCP advancements.

 struct dhcp *dhcp_data = netif_dhcp_data(&gnetif);
	  if (dhcp_data != NULL) {
	      printf("[DHCP] State: %d, Retries: %d\r\n", dhcp_data->state, dhcp_data->tries);
	  }

this shows I get stuck in state 6: waiting for an ACK

-> what could be behind this?

can someone share an .ioc file that sets everything correctly in MX?

1 ACCEPTED SOLUTION

Accepted Solutions
GStou
Associate III

Some extra experimenting: changed the MCU voltage to 1.8V and the network behaves exactly as with the -DK board: DHCP-Timeout

Back to 3V3 an the DHCP process is successful.

Went back to the original board and found no option to alter the MCU Vdd.

But I found a header jp6, which I was not really getting any wiser on what it does.

search through the schematics relates it to the RMII, what if?

Tried to alter this setting and the DHCP server is responding.

-> JP6 needs to be in position PC1

View solution in original post

14 REPLIES 14
mƎALLEm
ST Employee

Hello,

What do you mean by "DORA" in the title?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Discover

Offer

Request

Acknowledge

The packet exchange procedure of the DHCP proces

STackPointer64
ST Employee

Hello @GStou,

First things first, could you please answer the following questions to help me better understand the issue?

  • Have you tried capturing the network traffic using Wireshark?
  • Was an ARP announcement packet sent?
  • Are you certain that your DHCP server is functioning correctly?
  • Could you also attach your STM32CubeMX configuration (.ioc file) so I can review it?

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
Andrew Neil
Super User

Some LwIP debug/diagnostic tips/resources:

https://community.st.com/t5/stm32-mcus-products/lwip-ethernet-in-stm32h7-working-in-stm32cubeide-but-not-in-iar/m-p/748501/highlight/true#M267524

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

I tried to reproduce the situation, as I was not trusting the waiting for ACK situation.

If true, the IP address should have been listed on the router DHCP server.

Now the board doesn't even identify the presence of the Ethernet cable anymore. LED's are on.

LED's could simply be the driver chip identifying the electric status of a connected Ethernet cable.

Can it be that I changed bit's on the board/µC that make things go bad?

Settings that remain over reprogramming?

Hello @GStou,

Have you tried inspecting the following project available in our GitHub repository? Please focus on the LwIP configuration and the DHCP implementation in the application, as the issue may be related to a misconfiguration in DHCP or the descriptors:

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.

Additionally, could you attach your STM32CubeMX configuration (.ioc) file, lwip.c, lwipopts.h, ethernetif.c, and the linker file so I can review your configuration and determine the most likely misconfiguration?

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.

Hello,

Sorry for replying so slow, had other tasks to complete.

I took the STM32H7RS cube package from the ST Website:

https://www.st.com/en/embedded-software/stm32cubeh7rs.html

installed it on my board, as explained in the readme document.

The TFTP server starts byt claims no DHCP server responds: 

TFTP Server
           STM32H7S78-DK board
                              State: Ethernet Initialization ...
                                                                State: Looking f                                          or DHCP server ...
                  DHCP Timeout !!
                                  Static IP address: 192.168.0.10

 Using the same cable, a W11 laptop immediately gets and address.

I also tried the screen driver, which worked.

Hello @GStou

It is not the same situation with the laptop. The laptop can contact the DHCP server on your network, whereas when you connect the STM32 board to your laptop, it cannot do the same thing. To solve this, you need to install a local DHCP server so it can assign an IP address to your board when it is plugged in. Try downloading and installing an application like Tftpd64; it should solve this issue.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.