Connect cellular module to internet in ECM mode

Set a Quectel or Telit mini PCIe module to ECM mode: the module appears to Linux as a USB Ethernet interface, with no extra software. Configure it with AT commands, connect and test.

Show steps for

In ECM (Ethernet Control Model) mode, the cellular module appears to Linux as a USB Ethernet interface, handled by the kernel’s cdc_ether driver; no extra software is needed.

Requirements

Finish the quickstart of the board first: Get started with Base HAT, Get started with 4G/LTE Cellular Modem Kit or Get started with Jetson Nano Cellular Modem Kit.

Required

Hardware

  • Base HAT, 4G/LTE Cellular Modem Kit or Jetson Nano Cellular Modem KitAssembled as in the quickstart of the Base HAT, the 4G/LTE kit or the Jetson Nano kit, with the USB cable connected.
  • A module that supports ECMTested: Quectel EC25-A, EC25-E, EC25-AU and EG25-G; Telit LE910C1, LE910C4 (NF, EU, AP) and ME910C1-WW. The EC25-AF does not support ECM; other variants are not tested.

SIM

  • SIM card with data serviceIts APN: super for the Sixfab SIM and the KORE Super SIM (formerly Twilio Super SIM).

Software

Stop ModemManager

On Raspberry Pi OS Bookworm and later, ModemManager is installed by default and can take over the module’s ports. Without ModemManager, skip this stage.

  1. Stop and disable ModemManager

    sudo systemctl stop ModemManager.service
    sudo systemctl disable ModemManager.service

    To remove it instead, see Remove ModemManager.

Configure module

Check network registration

  1. Open AT port again

    After the restart, open the AT port again. Registration can take a few minutes, depending on the network.

  2. Check SIM and registration

    Send each command:

    CommandChecksExpected answer
    AT+CPIN?SIM status+CPIN: READY
    AT+CSQSignal qualityFor example +CSQ: 25,99; 99,99 means no signal
    AT+CREG?Network registration+CREG: 0,1 (home network) or +CREG: 0,5 (roaming)
    AT+COPS?OperatorFor example +COPS: 0,0,"T-Mobile"
    AT+CGDCONT?APN of each contextContext 1 with your APN, for example +CGDCONT: 1,"IPV4V6","super",…

Start connection

Verify

The interface is usb0 (Quectel) or wwan0 (Telit); the name can differ with the operating system and kernel. The outputs below are from a Quectel module.

  1. Check address and routing table

    ip addr show usb0
    route -n
    $ ip addr show usb0
    6: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 6e:a6:1a:53:e6:e8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.57/24 brd 192.168.225.255 scope global dynamic noprefixroute usb0
    valid_lft 42918sec preferred_lft 42918sec
    $ route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.225.1   0.0.0.0         UG    100    0        0 usb0
    0.0.0.0         192.168.68.1    0.0.0.0         UG    600    0        0 wlan0
    192.168.68.0    0.0.0.0         255.255.255.0   U     600    0        0 wlan0
    192.168.225.0   0.0.0.0         255.255.255.0   U     100    0        0 usb0

    The interface has an IPv4 address. With several interfaces, the one with the lowest metric carries the traffic: here usb0 (100) before wlan0 (600).

  2. Ping through cellular interface

    ping -I usb0 -c 5 sixfab.com
    Result: five replies and 0% packet loss; addresses and times differ by network.

Details

Remove ModemManager

Instead of stopping and disabling ModemManager, remove it:

sudo apt purge modemmanager -y

Troubleshooting

If the interface does not appear, restart the computer and check the SIM, the antennas, the module seating and the USB cable (Base HAT troubleshooting). Then check the module:

CheckCommandExpected answer
ECM mode is set (Quectel)AT+QCFG="usbnet"+QCFG: "usbnet",1
ECM mode is set (Telit)AT#USBCFG?4 on the LE910C1 and LE910C4, 3 on the ME910C1-WW
The ECM context is active (Telit)AT#ECM?#ECM: 0,1. With 0,0, send AT#ECM=1,0,"","",0.
The SIM is detectedAT+CPIN?+CPIN: READY
The module is registeredAT+CREG?+CREG: 0,1 or +CREG: 0,5
The APN is right and the context has an IP addressAT+CGCONTRDP (Quectel), AT+CGDCONT? (Telit)Your APN and an IP address

If wwan0 is listed by ip addr but has no IPv4 address, request one, and add a DNS server if names do not resolve:

sudo dhclient -v wwan0
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf

Next steps