cancel
Showing results for 
Search instead for 
Did you mean: 

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

taraben
Senior

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.

7 REPLIES 7
Piranha
Chief II
DMårt
Lead

I got the same issue: https://community.st.com/s/feed/0D53W00001VXhtSSAT

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer

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

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.

fialot
Associate II

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.

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-Computer
fialot
Associate II

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