Skip to main content
PTiha
Associate III
Jul 29, 2020 12:54 PM UTC
Solved

STM32F4 LWIP per-interface checksum calculation

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.
Piranha
PiranhaBest answer
Principal III
Aug 1, 2020 4:43 PM UTC

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
Jul 29, 2020 1:46 PM UTC

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
Aug 1, 2020 4:43 PM UTC

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
Aug 2, 2020 6:25 PM UTC

Thanks! :)