USB ECM buffer size

nicolas lantz


I am working on a demo using Ethernet Over USB on the nrf52840.

In subsys/usb/class/netusb/

I saw a misalignement probleme between the :
        .wMaxSegmentSize = sys_cpu_to_le16(1514),
        declared in function_ecm.c
and the :
        #define NETUSB_MTU 1500
        declared in netusb.h

As rx_buf & tx_buf are defined with a NETUSB_MTU size, this cause that the frames over 1500 bytes can not be received and are discarded.

Secondly, as fragmentation is not supported (for UDP and TCP datagram), I suggest to increase the  NETUSB_MTU to the maximum of the possible ethernet frame size :1522

These modifications give :
    in netusb.h : #define NETUSB_MTU 1522
    in function_ecm.c : .wMaxSegmentSize = sys_cpu_to_le16(NETUSB_MTU),

Attached a patch.


Nicolas LANTZ
M : +33 (0)6 19 07 43 43
T : +33 (0)9 52 96 81 86

Join to automatically receive all group messages.