Couldn't open serial comm 5G modem kit with RPi 5

I’m trying to connect to the SixFab 5G modem kit on Raspberry Pi 5 running Raspbian bookworm. Now that I have the atcom library installed in a virtual environment, I tried issuing this command:

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

And the response is:

[ERR] Couldn’t open serial communication

Here’s the the output of ifconfig:

$ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.225.43 netmask 255.255.255.0 broadcast 192.168.225.255
inet6 fe80::4c34:9c0a:98c6:2734 prefixlen 64 scopeid 0x20
ether 3e:fc:38:17:ef:0b txqueuelen 1000 (Ethernet)
RX packets 684 bytes 59391 (57.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1555 bytes 127370 (124.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

The SIM card is in the slot, there’s power to both the pi and the modem. The modem shows one blue and one red LED, both steady on.

What else should I try?

If you need to send " or ' character, you should use escape character \ before it.

atcom AT+CGDCONT=1,\“IPV4V6\”,\“super\”

That is exactly what I typed:

atcom AT+CGDCONT=1,\“IPV4V6\”,\“super\”

Same result:

(.env) pi@xyz:~ $ atcom AT+CGDCONT=1,\“IPV4V6\”,\“super\”
[ERR] Couldn’t open serial communication

What else can I try?

Check if the serial port is accessible and available:

ls /dev/tty*

Ensure that your user has the necessary permissions to access the serial port.

Can you try through another port, maybe ttyUSB2 is busy:
Example:

atcom --port /dev/ttyUSB3 AT

Can you also test sending an AT command with minicom:

sudo minicom -D /dev/ttyUSB2 -b 115200

Results of ls /dev/tty*

/dev/tty    /dev/tty16  /dev/tty24  /dev/tty32  /dev/tty40  /dev/tty49  /dev/tty57  /dev/tty8
/dev/tty0   /dev/tty17  /dev/tty25  /dev/tty33  /dev/tty41  /dev/tty5   /dev/tty58  /dev/tty9
/dev/tty1   /dev/tty18  /dev/tty26  /dev/tty34  /dev/tty42  /dev/tty50  /dev/tty59  /dev/ttyAMA10
/dev/tty10  /dev/tty19  /dev/tty27  /dev/tty35  /dev/tty43  /dev/tty51  /dev/tty6   /dev/ttyprintk
/dev/tty11  /dev/tty2   /dev/tty28  /dev/tty36  /dev/tty44  /dev/tty52  /dev/tty60  /dev/ttyUSB0
/dev/tty12  /dev/tty20  /dev/tty29  /dev/tty37  /dev/tty45  /dev/tty53  /dev/tty61  /dev/ttyUSB1
/dev/tty13  /dev/tty21  /dev/tty3   /dev/tty38  /dev/tty46  /dev/tty54  /dev/tty62  /dev/ttyUSB2
/dev/tty14  /dev/tty22  /dev/tty30  /dev/tty39  /dev/tty47  /dev/tty55  /dev/tty63  /dev/ttyUSB3
/dev/tty15  /dev/tty23  /dev/tty31  /dev/tty4   /dev/tty48  /dev/tty56  /dev/tty7

Then I tried the following commands, and only USB1 had a different response:

(.env) pi@hvoiot:~ $ atcom --port /dev/ttyUSB0 AT
[ERR]   Couldn't open serial communication
(.env) pi@hvoiot:~ $ atcom --port /dev/ttyUSB1 AT
[ERR]   Timeout, couldn't get response
(.env) pi@hvoiot:~ $ atcom --port /dev/ttyUSB2 AT
[ERR]   Couldn't open serial communication
(.env) pi@hvoiot:~ $ atcom --port /dev/ttyUSB3 AT
[ERR]   Couldn't open serial communication

Using minicom (and with local echo turned on), I got a response on USB2 (although, notably, the command with escaped quotes did not work):

(.env) pi@hvoiot:~ $ sudo minicom -D /dev/ttyUSB2 -b 115200
Welcome to minicom 2.8                                                              
                                                                                    
OPTIONS: I18n                                                                       
Port /dev/ttyUSB2, 10:21:13                                                         
                                                                                    
Press CTRL-A Z for help on special keys                                             
                                                                                    
AT                                                                                  
                                                                                    
OK                                                                                  
AT+CGDCONT=1,\"IPV4V6\",\"super\"                                                   
                                                                                    
ERROR                                                                               
AT+CGDCONT=1,"IPV4V6","super"                                                       
                                                                                    
OK

Then, after a delay, this was displayed:

+CIEV: 4,0                                                                          
                                                                                    
+CIEV: 4,1

+QUSIM: 1

+QIND: SMS DONE

+QIND: PB DONE

Just for completeness, I also ran lsusb:

Bus 004 Device 002: ID 2c7c:0800 Quectel Wireless Solutions Co., Ltd. RM502Q-AE
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 17ef:608d Lenovo Optical Mouse
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and usb-devices for the Quectel:

T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
P:  Vendor=2c7c ProdID=0800 Rev=04.14
S:  Manufacturer=Quectel
S:  Product=RM502Q-AE
S:  SerialNumber=ce2a5a43
C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=88(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
I:  If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms

So minicom seems to have helped. Now the question is, why doesn’t this work from the shell prompt?

I sent this command via minicom and it seemed to work:

atcom AT+CFUN=1,1

Then I looked at usb0 to see if there was an IP address, and there is:

(.env) pi@hvoiot:~ $ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.225.31  netmask 255.255.255.0  broadcast 192.168.225.255
        inet6 fe80::e1a3:d93c:ddb3:6919  prefixlen 64  scopeid 0x20<link>
        ether 56:24:c7:85:0f:1a  txqueuelen 1000  (Ethernet)
        RX packets 57  bytes 5541 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 95  bytes 10589 (10.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

But the ping did not work:

(.env) pi@hvoiot:~ $ ping -I usb0 sixfab.com -c 5
ping: sixfab.com: Temporary failure in name resolution

Lastly, I can’t seem to install anything using apt or pip due to network issues created by turning on the modem. So I must shutdown, unplug the modem, boot up, then install software, shutdown, plug in the modem, and boot up. Is this normal?

With Minicom, you can establish communication with the modem. Replace this command with the APN of your 5G SIM provider and send it again. ‘super’ is the APN for Sixfab SIM. It does not support 5G.

After setting the APN, if everything is fine with the SIM, you should be able to ping.