Cellular Internet Connection in ECM Mode

ECM (Ethernet Control Model) is the easiest method in order to provide an internet connection to your single-board computer such as Raspberry Pi. This tutorial describes how to configure your cellular module for the ECM mode.

Compatible Modules

The ECM mode successfully works on LE910Cx - NF, EU, AP and ME910C1-WW.

Prepare Hardware

It is important to properly setup your hardware before you get started. To setup the hardware please follow:


Note 1: Make sure the USB is connected.

Uninstall Modem Manager Service

The Modem Manager service is installed by default on the Raspberry Pi OS (Bookworm). For a smooth ECM connection, this service must be uninstalled. To uninstall it, run the following command. If it is not installed, skip this step.

sudo apt purge modemmanager -y

Configuration

First, let's ensure that the Telit cellular module is correctly loaded in Linux. Telit modules are most often automatically detected in recent Linux kernels, this can be verified in different ways by the commands below.

The lsusb command is used to display the information about USB buses and the devices connected to them.

lsusb

It can look e.g. like this:

pi@raspberrypi:~ $ lsusb Bus 001 Device 112: ID 1bc7:1206 Telit Wireless Solutions LE910C4-NF
pi@raspberrypi:~ $ lsusb Bus 001 Device 024: ID 1bc7:1102 Telit Wireless Solutions Telit ME910

The lsusb -t command shows the USB endpoints of detected USB devices and related drivers.

pi@raspberrypi:~ $ lsusb -t /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M |__ Port 1: Dev 112, If 0, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 112, If 1, Class=Vendor Specific Class, Driver=, 480M |__ Port 1: Dev 112, If 2, Class=Communications, Driver=cdc_ether, 480M |__ Port 1: Dev 112, If 3, Class=CDC Data, Driver=cdc_ether, 480M |__ Port 1: Dev 112, If 4, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 112, If 5, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 112, If 6, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 112, If 7, Class=Vendor Specific Class, Driver=option, 480M

We can start communicating with the cellular module over AT commands. There are different implementations on Linux that enable communication with serial interfaces. You can check out the Sending AT Commands tutorial.

Configure APN

APN is super if you are using Sixfab SIM. If you do not know your APN, contact your SIM provider.
In this case, the command should be:

AT+CGDCONT=1,"IPV4V6","super"

Configure Module

Now, we can start to configure the modem for ECM mode. Execute the following command for the LE910Cx series module.

AT#USBCFG=4

For the ME910C1-WW module, do the following.

AT#USBCFG=3

The modem may reboot after the execution of the command.

Reboot the Module

Then reboot the modem using the following command.

AT#REBOOT

Wait for the modem to boot again. It may take 30 seconds. After the reboot, open a new Linux terminal and check for usbX in the network interface using ifconfig or ipaddr commands.

Internet Connection

Then start the internet connection using the following command. If you get ERROR please try the same command again.

AT#ECM=1,0
Note 2: When the modem reboots or the internet connection is lost for any reason, you have to run AT#ECM=1,0 command again to establish the internet connection. It may take a few minutes to establish the connection depending on the network.
Note 3: The response to all AT commands should be OK.

Test Internet Connection

Once the internet is active you should see wwan0 in your internet interface. You can use route -n or ip addr and look for wwan0 interface. Now check the assigned IP address and test the connection.

pi@raspberrypi:~ $ ifconfig wwan0 wwan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.225.45 netmask 255.255.255.0 broadcast 192.168.225.255 inet6 fe80::ee84:31a0:e65d:c5c3 prefixlen 64 scopeid 0x20 ether f2:0a:30:b7:9c:73 txqueuelen 1000 (Ethernet) RX packets 391 bytes 19933 (19.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 438 bytes 30915 (30.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
pi@raspberrypi:~ $ ping -I wwan0 -c 5 sixfab.com PING sixfab.com (172.67.75.126) from 100.67.114.164 wwan0: 56(84) bytes of data. 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=1 ttl=29 time=247 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=2 ttl=29 time=205 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=3 ttl=29 time=207 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=4 ttl=29 time=204 ms 64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=5 ttl=29 time=216 ms --- sixfab.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 8ms rtt min/avg/max/mdev = 204.050/215.839/247.004/16.201 ms

Troubleshooting

If the wwan0 interface is not visible reboot your whole system, check your SIM, antenna, module and USB.

After issuing the AT#ECM command to the Telit module, if the wwan0 interface doesn't appear under the ifconfig or route -n but available under ip addr command, run sudo dhclient -v wwan0. Later add nameserver 8.8.8.8 in /etc/resolve.conf.

Check the configuration of the module.

AT#USBCFG? # Should return 3 or 4

Check the TCP context is activated.

AT#ECM? # Should return 0,1. If return is 0,0 run the AT#ECM=1,0,"","",0 command in minicom.

Check the SIM is detected by the module.

AT+CPIN? # Should return READY

Check if the module is registered to the network.

AT+CREG? # Should return 0,1 or 0,5

Check the APN is right and have an IP.

AT+CGDCONT? # Should return the APN details and IP address

Compatible Modules

The ECM mode successfully works on EC25-A, EC25-E, EC25-AU, EG25-G variants. The EC25-AF does not support it. The rest of the variants are not tested.

Prepare Hardware

It is important to properly setup your hardware before you get started. To setup the hardware please follow:


Note 1: Make sure the USB is connected.

Uninstall Modem Manager Service

The Modem Manager service is installed by default on the Raspberry Pi OS (Bookworm). For a smooth ECM connection, this service must be uninstalled. To uninstall it, run the following command. If it is not installed, skip this step.

sudo apt purge modemmanager -y

Configuration

First, let's ensure that the Quectel cellular module is correctly loaded in Linux. Quectel modules are most often automatically detected in recent Linux kernels, this can be verified in different ways by the commands below:

The lsusb command is used to display the information about USB buses and the devices connected to them.

lsusb

It can look e.g. like this:

pi@raspberrypi:~ $ lsusb Bus 001 Device 002: ID 2c7c:0125 Quectel Wireless Solutions Co., Ltd. EC25 LTE modem

The lsusb -t command shows the USB endpoints of detected USB devices and related drivers.

pi@raspberrypi:~ $ lsusb -t /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 2, If 1, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 2, If 2, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 2, If 3, Class=Vendor Specific Class, Driver=option, 480M |__ Port 1: Dev 2, If 4, Class=Communications, Driver=cdc_ether, 480M |__ Port 1: Dev 2, If 5, Class=CDC Data, Driver=cdc_ether, 480M

We can start communicating with the cellular module over AT commands. There are different implementations on Linux that enable communication with serial interfaces. You can check out the Sending AT Commands tutorial.

Configure APN

APN is super if you are using Sixfab SIM. If you do not know your APN, contact your SIM provider.
In this case, the command should be:

AT+CGDCONT=1,"IPV4V6","super"

Configure Module

Now, we can start to configure the modem for ECM mode.

AT+QCFG="usbnet",1

The modem may reboot after the execution of the command.

Reboot the Module

Then reboot the modem using the following command.

AT+CFUN=1,1

Wait for the modem to boot again. It may take 30 seconds. After the reboot, open a new Linux terminal and check for usbX in the network interface using ifconfig or ipaddr commands.

Note 2: It may take a few minutes to establish the connection depending on the network.
Note 3: The response to all AT commands should be OK.

Test Internet Connection

Once the internet is active you should see usbX in your internet interface. You can use ifconfig or ipaddr and look for usbX interface. Now check the assigned IP address and test the connection.

pi@raspberrypi:~ $ ifconfig usb0 usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.225.60 netmask 255.255.255.0 broadcast 192.168.225.255 inet6 fe80::8543:f6a0:e678:2e20 prefixlen 64 scopeid 0x20 ether 4a:aa:f8:62:36:bb txqueuelen 1000 (Ethernet) RX packets 73 bytes 5047 (4.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 100 bytes 15116 (14.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
pi@raspberrypi:~ $ ping -I usb0 sixfab.com -c 5 PING sixfab.com (104.26.9.221) from 192.168.225.60 usb0: 56(84) bytes of data. 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=1 ttl=52 time=209 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=2 ttl=52 time=202 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=3 ttl=52 time=192 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=4 ttl=52 time=193 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=5 ttl=52 time=195 ms --- sixfab.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 9ms rtt min/avg/max/mdev = 191.895/198.244/209.463/6.636 ms

Troubleshooting

If usbX interface is not visible reboot your whole system, check your SIM, antenna, module and USB.

Check the configuration of the module.

AT+QCFG="usbnet" # Should return 1

Check the SIM is detected by the module.

AT+CPIN? # Should return READY

Check if the module is registered to the network.

AT+CREG? # Should return 0,1 or 0,5

Check the APN is right and have an IP.

AT+CGCONTRDP # Should return the APN details and IP address.