RAK7243C having UART problems with LTE modem

Hi, I am using RAK7243C (Rapsberry Pi 3 + Quectel EG95 LTE module) with BalenaOS and I’m trying to get the LTE module to work. It works with regular raspbian firmware, so hardware issues can be ruled out.

What I have tried:

  1. mount -o remount,rw / and
    export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

  2. dtoverlays: "pi3-disable-bt", "disable-bt","uart-ctsrts"

  3. systemctl disable hciuart

  4. Adding UDEV rules (/etc/udev/rules.d/98.rules)
    I also tried to set UDEV=0 without success.

        ACTION=="add|change|move", KERNEL=="soc", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
        ACTION!="add|change|move|bind", GOTO="mm_whitelist_end", DEVPATH=="/devices/platform/soc/3f201000.serial/tty/ttyAMA0", ENV{ID_MM_DEVICE_PROCESS}="1", LABEL="mm_whitelist_end"
        SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0195", NAME="LTE"
  1. mmcli for testing:
    mmcli -S and mmcli -L finds no modems.

  2. Enabling Module with GPIO bash script provided by RAK Wireless.(blue LED is indicating that the module is on).

  3. minicom:
    minicom -D /dev/ttyAMA0 -b 115200
    I am able to communicate with the module using minicom to get responses from it, but the communication is bad, it doesn’t always take in my commands and spams random characters like if the baud rate would be wrong, check screenshot below:
    (It does at least show up correct carriers of my location, but some characters seems wrong. )

Logs:
dmesg

    [    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=tty1 rootfstype=ext4 rootwait root=PARTUUID=1f3ff645-02 rootwait
    [    0.000891] console [tty1] enabled
    [    0.943911] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2

ModemManager (–debug)

root@d60fd98:~# journalctl -u ModemManager -f
-- Logs begin at Mon 2020-01-27 17:10:56 UTC. --
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708321] [plugin manager] task 2: no active tasks to probe
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708407] [plugin manager] task 2,eth0: deferred task completed, no suggested plugin
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708497] [plugin manager] task 2,eth0: finished in '2.500322' seconds
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708601] [plugin manager] task 2,eth0: not supported by any plugin
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708710] [device /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1] fully ignoring port 'net/eth0' from now on
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708808] [plugin manager] task 2: no more ports to probe
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.708894] [plugin manager] task 2: finished in '2.500962' seconds
May 04 15:48:58 d60fd98 ModemManager[2465]: [1588607338.709011] Couldn't check support for device '/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1': not supported by any plugin
May 04 15:49:01 d60fd98 ModemManager[2465]: [1588607341.507305] Parsing AT got: 'Serial command timed out'
May 04 15:49:01 d60fd98 ModemManager[2465]: [1588607341.507692] (ttyAMA0): --> 'AT<CR>'
May 04 15:49:04 d60fd98 ModemManager[2465]: [1588607344.507337] Parsing AT got: 'Serial command timed out'
May 04 15:49:04 d60fd98 ModemManager[2465]: [1588607344.507707] (ttyAMA0): --> 'AT<CR>'
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.507335] Parsing AT got: 'Serial command timed out'
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.507561] (tty/ttyAMA0) port is not AT-capable
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.507763] (tty/ttyAMA0) probing QCDM...
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.507867] (ttyAMA0) device open count is 0 (close)
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.507957] (ttyAMA0) closing serial port...
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.508105] (ttyAMA0) serial port closed
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.508235] (ttyAMA0) forced to close port
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.508659] (ttyAMA0) opening serial port...
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.508916] (ttyAMA0) device open count is 1 (open)
May 04 15:49:07 d60fd98 ModemManager[2465]: [1588607347.509115] (ttyAMA0): --> 7e 00 78 f0 7e
May 04 15:49:10 d60fd98 ModemManager[2465]: [1588607350.507532] (ttyAMA0): --> 7e 00 78 f0 7e
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.506934] (tty/ttyAMA0) port is not QCDM-capable
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507171] (Quectel) [ttyAMA0] filtered by vendor strings
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507285] [plugin manager] task 0,ttyAMA0: checking with plugin 'Via CBP7'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507464] (Via CBP7) [ttyAMA0] probe required: 'at, at-vendor, at-product'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507571] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507737] (ttyAMA0) device open count is 0 (close)
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507830] (ttyAMA0) closing serial port...
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.507980] (ttyAMA0) serial port closed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508112] (ttyAMA0) forced to close port
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508260] (Via CBP7) [ttyAMA0] filtered as no vendor/product strings given
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508361] [plugin manager] task 0,ttyAMA0: checking with plugin 'Iridium'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508510] (Iridium) [ttyAMA0] probe required: 'at, at-vendor, at-product'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508613] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508770] (Iridium) [ttyAMA0] filtered as no vendor/product strings given
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.508868] [plugin manager] task 0,ttyAMA0: checking with plugin 'Cinterion'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509000] (Cinterion) [ttyAMA0] probe required: 'at, at-vendor'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509101] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509247] (Cinterion) [ttyAMA0] filtered by vendor strings
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509339] [plugin manager] task 0,ttyAMA0: checking with plugin 'Nokia'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509477] (Nokia) [ttyAMA0] probe required: 'at, at-vendor, at-icera'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509577] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509721] (Nokia) [ttyAMA0] filtered by vendor strings
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509837] [plugin manager] task 0,ttyAMA0: checking with plugin 'u-blox'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.509972] (u-blox) [ttyAMA0] probe required: 'at, at-vendor'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510070] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510214] (u-blox) [ttyAMA0] filtered by vendor strings
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510307] [plugin manager] task 0,ttyAMA0: checking with plugin 'Telit'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510438] (Telit) [ttyAMA0] probe required: 'at, at-vendor'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510537] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510680] (Telit) [ttyAMA0] filtered by vendor strings
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510775] [plugin manager] task 0,ttyAMA0: checking with plugin 'Generic'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.510904] (Generic) [ttyAMA0] probe required: 'at, qcdm'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511010] (tty/ttyAMA0) port probing finished: no more probings needed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511155] [plugin manager] task 0,ttyAMA0: found best plugin for port (Generic)
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511249] [plugin manager] task 0,ttyAMA0: finished in '17.337522' seconds
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511368] [plugin manager] task 0: no more ports to probe
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511451] [plugin manager] task 0: finished in '17.338209' seconds
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.511590] [device /sys/devices/platform/soc] creating modem with plugin 'Generic' and '1' ports
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.518316] Could not grab port (tty/ttyAMA0): 'Cannot add port 'tty/ttyAMA0', unhandled serial type'
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.518552] Modem (Generic) '/sys/devices/platform/soc' completely disposed
May 04 15:49:13 d60fd98 ModemManager[2465]: [1588607353.518654] Couldn't create modem for device '/sys/devices/platform/soc': Failed to find primary AT port

The ModemManager gives the error Could not grab port (tty/ttyAMA0): 'Cannot add port ‘tty/ttyAMA0’, unhandled serial type’ for the used port, I have not been able to find any information on what that error means. It looks maybe like the communication is so broken that it can’t get any proper responses from it(as minicom also had problems).

Thanks in advance!

Hi @tibhel - thanks for your post. I have a few questions to get some more info about your setup:

  • What version of BalenaOS and Raspbian are you using? If you’re not using the latest release for balenaOS, can you try upgrading to that?
  • You show the output of a number of commands run in balenaOS (minicom, mmcli -S / -L, modemmanager logs) – thanks very kindly for that! Can you show the output of those commands in Raspbian, so we know what it looks like when things are working?
  • I notice that you’re using a couple of dtoverlays to disable Bluetooth; can you give some context for why you’re doing that?
  • You mention enabling the module with a GPIO Bash script; are you able to share that script?

If we can get this additional info, this will help us get a better idea of what’s going on for your device.

All the best,
Hugh

Hi Hugh!

Sure, here is the additional information:

  • Latest balenaOS 2.47.0+rev1 (dev mode) and Raspbian Buster Lite 4.19.
  • minicom log using Raspbian Buster Lite:
Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyAMA0, 10:46:17

Press CTRL-A Z for help on special keys

at+cops=?
+COPS: (1,"3 SE","3 SE","24002",2),(1,"3 SE","3 SE","24002",7),(1,"TELIA S","TELIA","24001",2),(1,"Tele2","Tele2 SE","24007",2),(1,"Sweden Mobile","MobileS","24024",0),(1,"TELIA S","TELIA","24001",0),(1,"Telenor SE","TelenorS","24008",2),(1,"Tele2","Tele2 SE","24007",7),(1,"Telenor SE","TelenorS","24008",7),(1,"TELIA S","TELIA","24001",)


OK

As you see above, all characters are being transmitted correctly in both ways comparing to how it looked using BalenaOS.

  • mmcli and ModemManager log: Actually I am getting the same result using Rasbian, instead I have used RAK owns software that does this for me and can establish a connection without Modem Manager (I should change the title of this thread): https://github.com/RAKWireless/rak_common_for_gateway.

To establish a connection, the rak_common_for_gateway/lte/pppd.sh is run. I just installed rak_common_for_gateway using a docker image and run it without success(serial communication timeout as expected):
pppd.sh on BalenaOS:

root@d60fd98:/usr/src/app/rak_common_for_gateway/lte# ./pppd.sh
./pppd.sh: line 3: killall: command not found
pppd options in effect:
debug           # (from /etc/ppp/peers/gprs)
nodetach                # (from /etc/ppp/peers/gprs)
dump            # (from /etc/ppp/peers/gprs)
noauth          # (from /etc/ppp/peers/gprs)
remotename 3gppp                # (from /etc/ppp/peers/gprs)
/dev/ttyAMA0            # (from /etc/ppp/peers/gprs)
115200          # (from /etc/ppp/peers/gprs)
lock            # (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T online.telia.se          # (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect               # (from /etc/ppp/peers/gprs)
nocrtscts               # (from /etc/ppp/peers/gprs)
modem           # (from /etc/ppp/peers/gprs)
asyncmap 0              # (from /etc/ppp/options)
lcp-echo-failure 4              # (from /etc/ppp/options)
lcp-echo-interval 30            # (from /etc/ppp/options)
hide-password           # (from /etc/ppp/peers/gprs)
novj            # (from /etc/ppp/peers/gprs)
novjccomp               # (from /etc/ppp/peers/gprs)
ipcp-accept-local               # (from /etc/ppp/peers/gprs)
ipcp-accept-remote              # (from /etc/ppp/peers/gprs)
ipparam 3gppp           # (from /etc/ppp/peers/gprs)
noipdefault             # (from /etc/ppp/peers/gprs)
ipcp-max-failure 30             # (from /etc/ppp/peers/gprs)
defaultroute            # (from /etc/ppp/peers/gprs)
usepeerdns              # (from /etc/ppp/peers/gprs)
noccp           # (from /etc/ppp/peers/gprs)
noipx           # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
alarm
Failed
Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T online.telia.se finished (pid 265), status = 0x3
Connect script failed

pppd.sh on Rasbian buster lite :
Successfully connected though serial:

pi@rak-gateway:~/rak_common_for_gateway $ sudo /usr/local/rak/bin/pppd.sh
pppd options in effect:
debug		# (from /etc/ppp/peers/gprs)
nodetach		# (from /etc/ppp/peers/gprs)
dump		# (from /etc/ppp/peers/gprs)
noauth		# (from /etc/ppp/peers/gprs)
remotename 3gppp		# (from /etc/ppp/peers/gprs)
/dev/ttyAMA0		# (from /etc/ppp/peers/gprs)
lock		# (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T online.telia.se		# (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect		# (from /etc/ppp/peers/gprs)
nocrtscts		# (from /etc/ppp/peers/gprs)
modem		# (from /etc/ppp/peers/gprs)
asyncmap 0		# (from /etc/ppp/options)
lcp-echo-failure 4		# (from /etc/ppp/options)
lcp-echo-interval 30		# (from /etc/ppp/options)
hide-password		# (from /etc/ppp/peers/gprs)
novj		# (from /etc/ppp/peers/gprs)
novjccomp		# (from /etc/ppp/peers/gprs)
ipcp-accept-local		# (from /etc/ppp/peers/gprs)
ipcp-accept-remote		# (from /etc/ppp/peers/gprs)
ipparam 3gppp		# (from /etc/ppp/peers/gprs)
noipdefault		# (from /etc/ppp/peers/gprs)
ipcp-max-failure 30		# (from /etc/ppp/peers/gprs)
defaultroute		# (from /etc/ppp/peers/gprs)
usepeerdns		# (from /etc/ppp/peers/gprs)
noccp		# (from /etc/ppp/peers/gprs)
noipx		# (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
OK
 -- got it

send (ATE0^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
EG95^M
Revision: EG95EFBR06A05M4G^M
^M
SubEdition: V01^M
^M
+CSQ: 15,99^M
^M
+COPS: 0^M
^M
+CGREG: 0,2^M
^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","online.telia.se",,0,0^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
 -- got it

Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T online.telia.se finished (pid 3695), status = 0x0
Serial connection established.
#! /bin/bash

# first enable the lte module

cd /sys/class/gpio/
echo 5 > export
echo 6 > export
echo 13 > export
echo 19 > export
echo 21 > export
echo 26 > export
echo out > gpio5/direction
echo out > gpio6/direction
echo out > gpio13/direction
echo out > gpio19/direction
echo in > gpio21/direction
echo out > gpio26/direction

echo 0 > gpio5/value
echo 0 > gpio6/value
echo 0 > gpio13/value
echo 0 > gpio19/value
echo 0 > gpio26/value

cd /sys/class/gpio/

echo "18" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio18/direction
echo 0 > /sys/class/gpio/gpio18/value
sleep 0.2
echo 1 > /sys/class/gpio/gpio18/value
sleep 0.2
echo 0 > /sys/class/gpio/gpio18/value

Thanks in advance!

Hi again,

Using BalenaOS (production version, have not tested dev mode with this port) I succeeded to get proper response and communication using serial port 0 (serial0 or ttyS0):
minicom -D /dev/ttyS0 -b 115200

Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on May  6 2018, 10:36:56.
Port /dev/ttyS0, 15:28:49

Press CTRL-A Z for help on special keys

at
OK
at+cops=?
+COPS: (1,"TELIA S","TELIA","24001",2),(1,"TELIA S","TELIA","24001",0),(2,"Telness","Telness","24001",7),(3,"Tele2","Tele2 SE","24007",7),(1,"3 SE","3 SE","24002",2),(3,"Tele2","Tele2 SE","24007",2),(1,"Sweden Mobile","MobileS","24024",0),(1,"Telenor SE","TelenorS","24008",2),(1,"Telenor SE","TelenorS","24008",7),(1,"3 SE","3 SE","24002",7),,(0-4),(0-2)

OK

I don’t know why this port has changed between the OS:s?

I will now try to get the pppd or ModemManager services to connect using the other port.

@saintaardvark I edited the pppd.sh script to use ttyS0 which successfully worked and connected to the internet using BalenaOS.

Now it would be good if ModemManager could work as it’s the preferred network manager for BalenaOS. How can I modify MM to function with that port instead of ttyAMA0?

Thanks in advance

Hi @saintaardvark,
I see this in the log of Modem Manager:

ModemManager[14504]: <debug> [1588779337.826235] (tty/ttyS0): adding device at sysfs path: /sys/devices/platform/soc/3f215040.serial/tty/ttyS0
ModemManager[14504]: <debug> [1588779337.827084] [filter] (tty/ttyS0): port filtered: tty platform driver 

How do I un-filter the ttyS0 from modem manager in BalenaOS?

Thanks in advance!

Hi @tibhel, I just answered to the other thread as well.

After you solve the filtering issue, please let me know how that goes for you as I am quite interested in the outcome.

Thanks,
Zahari