Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Minimum configuration for CDC ECM to work? #15880

Open
1 task done
tao-at-pricer opened this issue Feb 20, 2025 · 5 comments
Open
1 task done

[HELP] Minimum configuration for CDC ECM to work? #15880

tao-at-pricer opened this issue Feb 20, 2025 · 5 comments
Labels
Community: Question Further information is requested

Comments

@tao-at-pricer
Copy link

Description

Dear community, I've been having trouble to get USB CDC ECM to work, tried on both Raspberry Pi Zero W and STM32F4Discovery. There doesn't seem to be examples of how to configure this profile. I tried to get it show up in Debian as a standalone device, and as a composite together with a CDC ACM, the ACM worked fine, but couldn't see ECM popping up. My latest configure for STM32F4Discovery looks like this (composite and NOT working):

CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f4discovery"
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F407VG=y
CONFIG_ARCH_LEDS_CPU_ACTIVITY=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_COMPOSITE=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_CDCACM_RXBUFSIZE=256
CONFIG_CDCACM_TXBUFSIZE=256
CONFIG_CDCECM_COMPOSITE=y
CONFIG_COMPOSITE_IAD=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=8
CONFIG_IOB_NCHAINS=0
CONFIG_IOB_THROTTLE=0
CONFIG_LINE_MAX=64
CONFIG_MM_REGIONS=2
CONFIG_NETINIT_NOMAC=y
CONFIG_NETINIT_THREAD=y
CONFIG_NETUTILS_PING=y
CONFIG_NET_CDCECM=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_LOOPBACK_PKTSIZE=64
CONFIG_NET_MBIM=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAMLOG=y
CONFIG_RAMLOG_BUFSIZE=4096
CONFIG_RAMLOG_SYSLOG=y
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=27
CONFIG_START_YEAR=2013
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_OTGFS=y
CONFIG_STM32_PWR=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART2=y
CONFIG_SYSTEM_NSH=y
CONFIG_USBDEV=y
CONFIG_USBDEV_COMPOSITE=y
CONFIG_WQUEUE_NOTIFIER=y

Verification

  • I have verified before submitting the report.
@tao-at-pricer tao-at-pricer added the Community: Question Further information is requested label Feb 20, 2025
@acassis
Copy link
Contributor

acassis commented Feb 20, 2025

@tao-at-pricer seems like there are examples only for lpc17xx and sama5 boards. You need to look at these boards to understand how to configure the options in menuconfig and how to create the composite USB to use with ECM.

@adamfeuer since you configured it to your board, could you please give some hints here?

@tao-at-pricer
Copy link
Author

@tao-at-pricer seems like there are examples only for lpc17xx and sama5 boards. You need to look at these boards to understand how to configure the options in menuconfig and how to create the composite USB to use with ECM.

Thank you @acassis , yes I indeed found these two configurations and tried to copy the settings, but I was not able to reproduce. Since I don't have dev boards with these two MCUs I can't verify if the stock configures still work with them. I assume it worked at the time it was created, but with development evolving, I want to get a reassurance if someone can verify that. I'll post my settings based on these two moment later.

@tao-at-pricer
Copy link
Author

tao-at-pricer commented Feb 21, 2025

I'm still not able to get it working, after referencing both LPC17xx and SAMa5 examples, just some different errors pop up such as compiler complaining address containing double forward slash and so on. If someone can give a working example on either STM32 or Pi Pico, it will greatly shorten my try-n-error effort, still new to NuttX.

For example, by copying most of the configs from LPC17xx, I got error like this:

nuttxspace/nuttx$ make -j4
Create version.h
LN: platform/board to nuttxspace/apps/platform/dummy
Register: nsh
Register: sh
Register: ping
CPP:  nuttxspace/nuttx/boards/arm/rp2040/raspberrypi-pico-w/scripts/raspberrypi-pico-flash.ld-> nuttxspace/nuttx/boards/arm/rp2040/raspberrypi-pico-w/scripts/raLD: nuttx
arm-none-eabi-ld: nuttxspace/nuttx/staging/libarch.a(arm_initialize.o): in function `up_initialize':
arm_initialize.c:(.text.up_initialize+0x2): undefined reference to `arm_addregion'
arm-none-eabi-ld: nuttxspace/nuttx/staging/libapps.a(icmp_ping.c.home.tao.repos.nuttxspace.apps.netutils.ping_1.o): in function `icmp_ping':
icmp_ping.c:(.text.icmp_ping+0x6c): undefined reference to `socket'
arm-none-eabi-ld: icmp_ping.c:(.text.icmp_ping+0x14e): undefined reference to `sendto'
arm-none-eabi-ld: icmp_ping.c:(.text.icmp_ping+0x23a): undefined reference to `recvfrom'
Memory region         Used Size  Region Size  %age Used
           flash:         92 KB         2 MB      4.49%
            sram:        7012 B       264 KB      2.59%
make[1]: *** [Makefile:214: nuttx] Error 1
make: *** [tools/Unix.mk:552: nuttx] Error 2

Configuration for Pico W:

CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico-w"
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO_W=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_COMPOSITE=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_CDCECM_COMPOSITE=y
CONFIG_COMPOSITE_IAD=y
CONFIG_FS_BINFS=y
CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_RP2040_UART0=y
CONFIG_RP2040_USBDEV=y
CONFIG_RP2040_USBDEV_NOVBUS=y
CONFIG_MM_REGIONS=2
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETINIT_NOMAC=y
CONFIG_NET_CDCECM=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_SOCKOPTS=y
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_USBCONSOLE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_USBDEV_COMPOSITE=y
CONFIG_UART0_SERIAL_CONSOLE=y

@tao-at-pricer tao-at-pricer changed the title [HELP] <title> Minimum configuration for CDC ECM to work? [HELP] Minimum configuration for CDC ECM to work? Feb 21, 2025
@adamfeuer
Copy link
Contributor

@tao-at-pricer @acassis Hey there. I am still on NuttX 11.x for my SAMA5 app, TCP/IP over CDC/ECM works there. I will install 12.x and see if anything has changed.

I've never used CDC/ECM on a non-SAMA5 device, but I do have an STMF4-Discovery, so will try that out and see if I can get it to work, and report back.

Some questions. How are you looking to see if the CDCECM device is being recognized on the Linux side? The NuttX system will appear as a new ethernet interface. You should be able to see it using ifconfig.

In the meantime. I know this config works on the SAMA5 on 11.x:

https://github.com/apache/nuttx/blob/master/boards/arm/sama5/jupiter-nano/configs/sdmmc-nsh-net-resolvconf/defconfig

And you may have looked here, but this is the Kconfig file (used by the menuconfig system that configures NuttX) for CDCECM:

menuconfig NET_CDCECM

@tao-at-pricer
Copy link
Author

Thanks @adamfeuer , please let me know what you'll find out on the STM32F4 discovery board, I have exactly this and I read in multiple places that it's the recommended board for newbies to start with.

I did try the Mongoose example and it worked out of the box, link (https://mongoose.ws/documentation/tutorials/rp2040/pico-rndis-dashboard/), the title says RNDIS but it also contains example implementing CDC ECM, and that's the profile I used. When plugged in to computer it shows up as a network device and indeed I could find it with ip addr show, and I could use Wireshark and ScaPy to send and monitor ethernet packets. So I was expecting the same behavior when running NuttX examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants