I am trying to establish a data connection using the SORACOM Onyx dongle. I can see the dongle is detected by the Linux drivers:
[ 175.377627] usb 1-1: new high-speed USB device number 2 using musb-hdrc
[ 175.587334] usb 1-1: New USB device found, idVendor=2c7c, idProduct=0125, bcdDevice= 3.18
[ 175.596573] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 175.604299] usb 1-1: Product: EG25-G
[ 175.608223] usb 1-1: Manufacturer: Quectel
[ 175.632720] option 1-1:1.0: GSM modem (1-port) converter detected
[ 175.659056] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 175.669010] option 1-1:1.1: GSM modem (1-port) converter detected
[ 175.679745] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 175.688659] option 1-1:1.2: GSM modem (1-port) converter detected
[ 175.747959] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 175.756598] option 1-1:1.3: GSM modem (1-port) converter detected
[ 175.808229] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 176.942725] usbcore: registered new interface driver techship_serial
[ 176.950390] usbserial: USB Serial support registered for Cellular modem (1-port)
[ 177.281875] usbcore: registered new interface driver cdc_wdm
[ 177.418633] qmi_wwan 1-1:1.4: cdc-wdm0: USB WDM device
[ 177.486422] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-musb-hdrc.1-1, WWAN/QMI device, 0e:af:c4:9d:43:90
[ 177.498473] usbcore: registered new interface driver qmi_wwan
I can see the driver has acquired the correct manufacturer information:
[ 175.587334] usb 1-1: New USB device found, idVendor=2c7c, idProduct=0125, bcdDevice= 3.18
[ 175.596573] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 175.604299] usb 1-1: Product: EG25-G
[ 175.608223] usb 1-1: Manufacturer: Quectel
The ttyUSB* device notes for communicating with the driver have been all created:
ls -la /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Mar 7 09:25 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Mar 7 09:25 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 Mar 7 09:25 /dev/ttyUSB2
crw-rw---- 1 root dialout 188, 3 Mar 7 09:25 /dev/ttyUSB3
The port for communicating with the device is /dev/ttyUSB2. I can talk to the using AT commands. I have inserted an active SIM which I have made sure works and has enough data. I can check the following status of the SIM using AT commands:
echo -e "AT+CNUM\r\n" > /dev/ttyUSB2 | cat < /dev/ttyUSB2
+CNUM: "Own Number","0796125xxxx",129
OK
AT+CNUM
+CNUM: "Own Number","0796125xxxx",129
OK
From the below document in SORACOM site I see they are suggesting to use network manager: https://developers.soracom.io/en/start/connect/soracom-onyx-lte/ I do not want to use the network manager unless it is absolutely necessary. So I looked into the soracom-files.s3.amazonaws.com/connect/setup_eg25.sh file they proposed and can see in the setup file they are doing the below:
# Ensure to run the modem at the initial timing.
# After rebooting, `denyinterfaces wwan0` in `dhcpcd.conf` does the same thing.
if [ "$bullseye_or_later" = "true" ]
then
ifconfig wwan0 down
echo "Y" > /sys/class/net/wwan0/qmi/raw_ip
ifconfig wwan0 up
nmcli con down soracom
nmcli con up soracom
fi
I did the same in linux linux box (embedded linux):
ifconfig wwan0 down
echo "Y" > /sys/class/net/wwan0/qmi/raw_ip
ifconfig wwan0 up
And I can see the wwan0 interface is using ifconfig:
wwan0 Link encap:Ethernet HWaddr 0E:AF:C4:9D:43:90
inet6 addr: fe80::caf:c4ff:fe9d:4390/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
However, the below sys entry says the state of the interface is Unknow.
# cat /sys/class/net/wwan0/operstate
unknown
I tried to get an IP address for the wwan0 interface but it is not getting any using dhcp:
# udhcpc wwan0
udhcpc: started, v1.33.0
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
And it never gets an IP address. I am not sure if I am missing anything or using any of the tools incorrectly. Once I get an IP for the wwan0 interface I should be able to ping 8.8.8.8 I think and that should be I have a data connection in the system using the dongle. I am adding some additional information about the system as below: lsmod:
Module Size Used by Tainted: G
simcom_qmi_wwan 28672 0
cdc_wdm 24576 1 simcom_qmi_wwan
usbnet 45056 1 simcom_qmi_wwan
mii 16384 1 usbnet
techship_serial 40960 0
nft_ct 20480 4
nf_conntrack 167936 1 nft_ct
nf_defrag_ipv6 20480 1 nf_conntrack
nf_defrag_ipv4 16384 1 nf_conntrack
nft_limit 16384 4
nf_tables_set 32768 7
w1_gpio 16384 0
wire 45056 1 w1_gpio
ti_am335x_adc 16384 0
cn 16384 1 wire
pwm_fan 16384 0
kfifo_buf 16384 1 ti_am335x_adc
ti_emif_sram 16384 0
pwm_tiehrpwm 16384 1
c_can_platform 16384 0
c_can 20480 1 c_can_platform
can_dev 28672 1 c_can
lm75 20480 0
ad732x 16384 0
leds_pca955x 16384 0
stpm3x 32768 0
ina2xx 16384 0
hwmon 24576 4 wire,pwm_fan,lm75,ina2xx
phy_am335x 16384 2
phy_generic 16384 1 phy_am335x
omap_wdt 16384 1
watchdog 20480 2 omap_wdt
phy_am335x_control 16384 1 phy_am335x
tps65218_pwrbutton 16384 0
ti_am335x_tscadc 16384 1 ti_am335x_adc
evdev 24576 0
cpufreq_dt 16384 0
leds_gpio 16384 0
led_class 16384 2 leds_pca955x,leds_gpio
Kernel Version
# uname -a
Linux XXXX-54453800C2D6 5.4.106 #1 SMP Tue Mar 5 15:28:40 GMT 2024 armv7l GNU/Linux
PDP Context
# echo -e "at+cgdcont?\r\n" > /dev/ttyUSB2 | cat < /dev/ttyUSB2
at+cgdcont?
+CGDCONT: 1,"IP","super","0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","SOS","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1
OK
I just noticed that the ifplugd is taking the eth1 interface down as below:
Mar 7 10:51:19 ovo-ssb_dev ifplugd(eth1)[576]: Executing '/etc/ifplugd/ifplugd.action eth1 down'.
Mar 7 10:51:19 ovo-ssb_dev ifplugd(eth1)[576]: client: Cannot find device "eth1"
Mar 7 10:51:19 ovo-ssb_dev ifplugd(eth1)[576]: Program executed successfully.
Further Edit
I have been able to write the udev rule for the SORACOM Onyx dongle. SORACOM Onyx driver seems to be slightly different than the other dongle, as far as my observations so far. So the existing udev rules in the board/ovo/common/rootfs_overlay/etc/udev/rules.d/70-persistent-net.rules file doesn’t work for SORACOM. Alcatel and the D-Link dongles get detected withe the existing udev but not SORACOM. After a bit of faffing around, the rule I have added for SORACOM is detecting the dongle. The rule is as below:
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{type}=="1", NAME="eth1", RUN+="/opt/ovo/dongle_connection_bg.sh"
I might need to fine tune it a bit better, I will do that as I make progress.
So with the above rule in place, the dongle is detected, ifplugd kicks in, and renames the wwan0 interface to eth1:
[ 1617.540059] qmi_wwan 1-1:1.4 eth1: renamed from wwan0
I can see the eth1 interface in ifconfig list:
# ifconfig
....
eth1 Link encap:Ethernet HWaddr 22:A6:D9:88:69:7D
inet6 addr: fe80::20a6:d9ff:fe88:697d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
...
#
Then the ifplugd tries to brings up the eth1 interface:
Mar 8 09:52:56 ovo-ssb_dev ifplugd(eth1)[588]: Link beat detected.
Mar 8 09:52:57 ovo-ssb_dev ifplugd(eth1)[588]: Executing '/etc/ifplugd/ifplugd.action eth1 up'.
The custom script kicks in from the udev rule (below is the log file created by the custom script):
08/03/2024 09:52:56 - ========== Connectivity Module Found ==========
08/03/2024 09:52:56 - USB device with Product Vendor id of 2c7c:0125
08/03/2024 09:52:56 - USB Device is Soracom Onyx dongle module
08/03/2024 09:52:56 - Exiting script since we are using a Soracom Onyx dongle
However, the udhcpc is not being able to get an IP address for the dongle:
Mar 8 09:52:57 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: started, v1.33.0
Mar 8 09:52:57 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: sending discover
Mar 8 09:53:03 ovo-ssb_dev last message buffered 2 times
Mar 8 09:53:06 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: no lease, forking to background
Mar 8 09:53:07 ovo-ssb_dev ifplugd(eth1)[588]: Program executed successfully.
Ideally the cellular dongles get IP from the APN. At the moment I think the SIM which I got is not in service. So I used one of my personal EE sim. I need to figure out how to set the APN for the EE. So far, my experiments with the APN strings haven’t succeeded.
I am now using a Twilio SIM and I have come across this website which talks about the Twilio APN: https://www.twilio.com/docs/iot/supersim/apn-configuration
With the AP command I am setting the APN for the Twilio as “super“ as below:
AT+CGDCONT=1,"IP","super"
OK
I have installed minicom on the target board and running the below command to launch minicom:
minicom -o -s
Once the menu comes up I then change the port to /dev/ttyUSB2 and turn off Hardware Control. I can see the APN is getting set with the below AT command:
AT+CGDCONT?
+CGDCONT: 1,"IP","super","0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","SOS","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1
OK
However, ifplugd still doesn’t get an IP for the eth1 interface:
Mar 8 12:46:33 ovo-ssb_dev ifplugd(eth1)[588]: Link beat detected.
Mar 8 12:46:34 ovo-ssb_dev ifplugd(eth1)[588]: Executing '/etc/ifplugd/ifplugd.action eth1 up'.
Mar 8 12:46:34 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: started, v1.33.0
Mar 8 12:46:34 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: sending discover
Mar 8 12:46:40 ovo-ssb_dev last message buffered 2 times
Mar 8 12:46:43 ovo-ssb_dev ifplugd(eth1)[588]: client: udhcpc: no lease, forking to background
Mar 8 12:46:43 ovo-ssb_dev ifplugd(eth1)[588]: Program executed successfully.
I need to verify the state of the SIM, whether it is in a usable/ready-to-use state or not. When I inserted the SIM into my phone I couldn’t make a call or get any data connection.
Finally I have found a solution to my problem. I did the following:
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{type}=="1", NAME="eth1", RUN+="/opt/ovo/dongle_connection_bg.sh"
No need for this rule. I might need another rule to run a custom script to automate few things but certainly don't need to rename the interface wwan0.
ifconfig wwan0 down
echo Y > /sys/class/net/wwan0/qmi/raw_ip
ifconfig wwan0 up
qmicli -d /dev/cdc-wdm0 --device-open-net="net-raw-ip|net-no-qos-header" --wds-start-network="super" --client-no-release-cid
Notice the below parameter:
--wds-start-network="super"
"super" is the name of your APN. Please choose your APN name as appropriate. Once you do the above command you should see something like this:
[/dev/cdc-wdm0] Network started
Packet data handle: '2268864800'
[/dev/cdc-wdm0] Client ID not released:
Service: 'wds'
CID: '17'
udhcpc -i wwan0
udhcpc: started, v1.33.0
udhcpc: sending discover
udhcpc: sending select for 100.70.88.55
udhcpc: lease of 100.70.88.55 obtained, lease time 7200
deleting routers
adding dns 8.8.4.4
adding dns 8.8.8.8
ifconfig
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:49
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:50
eth0 Link encap:Ethernet HWaddr 54:45:38:00:C2:D6
inet addr:10.42.0.154 Bcast:10.42.0.255 Mask:255.255.255.0
inet6 addr: fe80::5645:38ff:fe00:c2d6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:190 errors:0 dropped:0 overruns:0 frame:0
TX packets:211 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:43733 (42.7 KiB) TX bytes:33343 (32.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wwan0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:100.70.88.55 P-t-P:100.70.88.55 Mask:255.255.255.240
inet6 addr: fe80::af43:c35:189f:ca38/64 Scope:Link
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=57 time=205.180 ms
64 bytes from 8.8.8.8: seq=1 ttl=57 time=187.328 ms
64 bytes from 8.8.8.8: seq=2 ttl=57 time=240.319 ms
64 bytes from 8.8.8.8: seq=3 ttl=57 time=199.615 ms
64 bytes from 8.8.8.8: seq=4 ttl=57 time=183.929 ms
64 bytes from 8.8.8.8: seq=5 ttl=57 time=207.818 ms
64 bytes from 8.8.8.8: seq=6 ttl=57 time=246.113 ms
64 bytes from 8.8.8.8: seq=7 ttl=57 time=200.538 ms
64 bytes from 8.8.8.8: seq=8 ttl=57 time=244.196 ms
64 bytes from 8.8.8.8: seq=9 ttl=57 time=198.751 ms
For full description of qmi-cli parameters please refer to the following link: https://www.freedesktop.org/software/libqmi/man/latest/qmicli.1.html