cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 LWIP per-interface checksum calculation

PTiha
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

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

View solution in original post

3 REPLIES 3
PTiha
Senior

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
Chief II

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

Thanks! :)