Skip to main content
PTiha
Associate III
July 29, 2020
Solved

STM32F4 LWIP per-interface checksum calculation

  • July 29, 2020
  • 3 replies
  • 1530 views

Hello!

I created a project for NUCLEO-F429ZI with two ethernet interfaces.

  • The first interface is the card's own ethernet connection.
  • The second is a USB-RNDIS virtual ethernet port.

The two ethernet interfaces work, but only if I enable software checksum generation on both interfaces.

Is there a way for the physical ethernet interface to use hardware checksum generation and the virtual one to use software checksum?

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

It's exactly the thing you required, therefore it is the right solution. :)

Also be warned:

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

3 replies

PTiha
PTihaAuthor
Associate III
July 29, 2020

Maybe solved:

On CubeMX/Checksum tab:

  • CHECKSUM_BY_HARDWARE: Disabled
  • LWIP_CHECKSUM_CTRL_PER_NETIF: Enabled

All other CHECKSUM_GEN_* options are enabled.

Then in lwip.c:

//For on-board ethernet:
NETIF_SET_CHECKSUM_CTRL(&gnetif, NETIF_CHECKSUM_DISABLE_ALL); 
 
//For RNDIS:
NETIF_SET_CHECKSUM_CTRL(tu_netif_ptr, NETIF_CHECKSUM_ENABLE_ALL);

Now it seems to work, but is it the right solution?

Piranha
PiranhaBest answer
Principal III
August 1, 2020

It's exactly the thing you required, therefore it is the right solution. :)

Also be warned:

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

PTiha
PTihaAuthor
Associate III
August 2, 2020

Thanks! :)