Skip to content

Add USB CDC-ECM Host support#18815

Open
dlizewski wants to merge 2 commits intoapache:masterfrom
dlizewski:feature/dl.usbecm
Open

Add USB CDC-ECM Host support#18815
dlizewski wants to merge 2 commits intoapache:masterfrom
dlizewski:feature/dl.usbecm

Conversation

@dlizewski
Copy link
Copy Markdown

@dlizewski dlizewski commented Apr 27, 2026

Summary

  • Added support for USB CDC-ECM host class. This host class is used for many USB-Ethernet adaptors as well as USB modems.
  • I also added support to select different configurations since the USB-Ethernet adaptor I have only presents CDC-ECM as the 2nd configuration. I split this into a separate commit.
  • New configuration with functional demo at nucleo-h563zi:nshusbnet.

Impact

  • Added a new USB CDC-ECM host class.
  • Adds ability to sleect different USB configurations.
  • All changes behind Kconfigs so changes will only be seen if enabled.

Testing

  • I have tested with with a few Quectel Modems that support CDC-ECM as well as a USB Ethernet adaptor I had.
  • In the attached logs I used newly created nucleo-h563zi:nshusbnet configuration and connected the USB-Ethernet adaptor nucleo-h563zi:nshusbnet (A Realtek RTL8153 Gigabit Ethernet Adaptor with integrated hub). I then enabled the interface, set DHCP, verified it got an IP, then pinged 8.8.8.8 with no packet loss.

Commands run:

telnetd [4:100]
usbhost_enumerate: ERROR: usbhost_classbind failed -22

NuttShell (NSH) NuttX-12.13.0
nsh> ifconfig
eth0	Link encap:Ethernet HWaddr 4c:e1:73:42:27:5e at RUNNING mtu 1500
	inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0

nsh> ifup eth0
ifup eth0...OK
nsh> ifconfig eth0 dhcp
nsh> ifconfig
eth0	Link encap:Ethernet HWaddr 4c:e1:73:42:27:5e at RUNNING mtu 1500
	inet addr:192.168.0.249 DRaddr:192.168.0.1 Mask:255.255.0.0

nsh> ping 8.8.8.8
PING 8.8.8.8 56 bytes of data
56 bytes from 8.8.8.8: icmp_seq=0 time=20.0 ms
56 bytes from 8.8.8.8: icmp_seq=1 time=10.0 ms
56 bytes from 8.8.8.8: icmp_seq=2 time=20.0 ms
56 bytes from 8.8.8.8: icmp_seq=3 time=10.0 ms
56 bytes from 8.8.8.8: icmp_seq=4 time=20.0 ms
56 bytes from 8.8.8.8: icmp_seq=5 time=10.0 ms
56 bytes from 8.8.8.8: icmp_seq=6 time=10.0 ms
56 bytes from 8.8.8.8: icmp_seq=7 time=20.0 ms
56 bytes from 8.8.8.8: icmp_seq=8 time=10.0 ms
56 bytes from 8.8.8.8: icmp_seq=9 time=20.0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
rtt min/avg/max/mdev = 10.000/15.000/20.000/5.000 ms

ecm_log.txt

Added support for selecting a different USB configuration.
Certain USB devices offer different classes using different
configurations. This allows a board file to provide a callback
to select the proper configuration for a given USB device.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
Added support for USB host to use an USB CDC-ECM device.
This class is used for usb-ethernet adapters as well as many modems.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
@github-actions github-actions Bot added Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Area: USB Board: arm labels Apr 27, 2026
@cederom
Copy link
Copy Markdown
Contributor

cederom commented Apr 27, 2026

Wow, very cool, thank you @dlizewski, and congratulations on your first contribution to the NuttX RTOS :-)

Could you please provide also a documentation for the new functionality? :-)

Pozdrawiam :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: USB Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants