Skip to main content
taraben
Associate III
Apr 28, 2022 1:20 PM UTC
Question

Ethernet HAL Driver CubeMX 6.5 and STM32F4 broken ICMP Ping, anyone knows how to fix?

Hello All,

I have updated to CubeMX 6.5 and STM32F4 1.27 and now thinks are failing in my project.

I could reproduce this using NucleoF429 board.

When I create example from example selector LwIP_HTTP_Server_Netconn_RTOS

  • it activates ethernet
  • I can ping the board

when I create example from the board selector nucleo429 and preset all peripherals to default it fails

  • I add LwIP
  • assign BSP driver LAN8742
  • TCP protocols are working
  • ICMP ping results in timeout on PC

My investigation shows:

  • a ping response is sent
  • the ping response has ICMP CRC set to 0(zero) and fails CRC check on pC
  • even I manually set ICMP CRC before sending via HAL driver, the driver modifies this CRC to 0(zero) ??????
  • also: I have to comment some stupid regression errors in the lwipopts.h

/*----- Default Value for H7 devices: 0x30044000 -----*/
// #define LWIP_RAM_HEAP_POINTER 0x30044000
/*----- Value supported for H7 devices: 1 -----*/
// #define LWIP_SUPPORT_CUSTOM_PBUF 1
  • you see this is very STM32F7 specific

I compared the working RTOS sample and the nonworking NO-RTOS sample.

I can not find differences in LWIP or HAL.

However the ethernetif.c/.h and lwip.c/.h are different.

The RTOS sample uses Transmit_IT() while the noRTOS uses Transmit() in side the ethernetif.c.

Has anyone encountered that defect?

Any hints?

Regards, Adib.

This topic has been closed for replies.

7 replies

Piranha
Principal III
Apr 29, 2022 1:05 AM UTC
AlexFabre
Visitor II
May 30, 2022 6:39 AM UTC

Hi @Piranha​ 

When you say "previous version" do you refer to stm32f4xx_hal_eth.c/.h from software packet 1.26 ? What about the differences between ethernetif.c/.h provided in the working exemple and the one generated from CubeMX 6.5 ?

Thank you for your help

Piranha
Principal III
Jun 5, 2022 12:01 PM UTC

Yes - from the most recent version before the reworked v1.27. As the driver's API in reworked version differs, ethernetif.c/.h files also must be relevant for the previous version.

Lead
Apr 29, 2022 6:21 PM UTC
STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-ComputerSTM32MP257FAK3 custom board with STM64-OS as operating system: https://github.com/DanielMartensson/STM64-Computer
fialot
Associate
Jun 13, 2022 7:58 AM UTC

I noticed after migration to new version FW 1.27 in the file lwipopts.h disappeared after generating code the definition:

#define CHECKSUM_GEN_ICMP 0

When I added it to the file, the PING command started working again.

Lead
Jun 14, 2022 7:42 PM UTC

How does your ping terminal looks when you don't have that line of code?

I'm using FW 1.27 and when I ping...I get no response, but it seems that it recieves the ping, but not sends back.

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-ComputerSTM32MP257FAK3 custom board with STM64-OS as operating system: https://github.com/DanielMartensson/STM64-Computer
fialot
Associate
Jun 20, 2022 8:41 AM UTC

I fixed some bugs of 1.27 Eth driver, which were mentioned in this thread:

https://community.st.com/s/question/0D53W00001VYkb5SAD/stm32f417-lwip-udp-packets-are-being-truncated

You must replace driver file, you will probably have it in the folder:

C:\Users\<user_folder>\STM32Cube\Repository\STM32Cube_FW_F4_V1.27.0\Drivers\STM32F4xx_HAL_Driver\Src