UART modem timeouts with NetworkManager
Hello everyone!
Context
I am currently working on a project involving SIM7000E NB-IoT HAT (available here https://www.waveshare.com/wiki/SIM7000E_NB-IoT_HAT) and a RPi 3B+ with Raspbian.
The goal is to connect this shield via UART and create a GSM connection to access the internet using Modem/Network manager
Initial config
- This will only work after upgrading the firmware to the version:
1351B08SIM7000E (link here: https://www.waveshare.com/wiki/File:1351B08SIM7000E.rar)
- First of all one should enable UART and disable bluetooth (this will enable the communication on /dev/ttyAMA0):
nano /boot/config.txt
enable_uart=1
dtoverlay=pi3-disable-bt
and also disable the serial console:
nano /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
- We can install then NetworkManager:
sudo apt-get install network-manager
- Since ModemManager greylist ttys we need to add the following udev rules:
nano /etc/udev/rules.d/98-modemmanager.rules
ACTION=="add",KERNEL=="ttyAMA0",ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
- After that we can disable the dhcpcd service to avoid conflict (and enable/disable Networkmanager for debug purpose only):
sudo systemctl disable dhcpcd
sudo systemctl disable/enable NetworkManager
sudo systemctl disable/enable ModemManager
- After that:
sudo reboot
Step to reproduce
- If everything went well, you should type this and get the following output:
sudo mmcli -m 0
--------------------------
General | dbus path: /org/freedesktop/ModemManager1/Modem/0
| device id: 9864e0fc536ab483ba251420118019ee15a338f6
--------------------------
Hardware | manufacturer: SIMCOM_Ltd
| model: SIMCOM_SIM7000E
| revision: Revision:1351B08SIM7000E
| supported: gsm-umts
| current: gsm-umts
| equipment id: 865234030840317
--------------------------
System | device: /sys/devices/platform/soc
| drivers: uart-pl011
| plugin: Generic
| primary port: ttyAMA0
| ports: ttyAMA0 (at)
--------------------------
Status | lock: sim-pin
| unlock retries: sim-pin (5), sim-pin2 (0), sim-puk (10), sim-puk2 (10)
| state: locked
| power state: on
| signal quality: 0% (cached)
--------------------------
Modes | supported: allowed: any; preferred: none
| current: allowed: any; preferred: none
--------------------------
IP | supported: ipv4, ipv6, ipv4v6
--------------------------
SIM | dbus path: /org/freedesktop/ModemManager1/SIM/0
- Then as we see we can unlock the sim-pin:
sudo mmcli -i 0 --pin=XXXX
successfully sent PIN code to the SIM
- Then enable the modem:
sudo mmcli -m 0 --enable --timeout=120
successfully enabled the modem
- Finally you can try to connect to your APN:
sudo mmcli -m 0 --simple-connect="apn=gprs.swisscom.ch"
successfully connected the modem
- At this point you can create a config with NetworkManager (this will open a command line interface):
sudo nmcli connection edit type gsm con-name "My GPRS Connection"
- Type/enter the following (you can use print to look at the current settings):
set gsm.apn gprs.swisscom.ch
set connection.interface-name ttyAMA0
set gsm.pin XXXX
set connection.autoconnect no
save
quit
- The last step is to connect:
sudo nmcli connection up "My GPRS Connection" ifname ttyAMA0
Results
- I would expect that nmcli would connect the device, but I instead got the following results:
- It seems to timeout for some reason but I have no idea why, has someone any idea?
Note
- These links were really helpful:
https://unix.stackexchange.com/questions/113975/configure-gsm-connection-using-nmcli
https://docs.ubuntu.com/core/en/stacks/network/modem-manager/docs/entering-sim-passwords
https://www.waveshare.com/wiki/SIM7000E_NB-IoT_HAT
- Debug can be done by disabling the Modem/Network manager service and run:
sudo /usr/sbin/NetworkManager --debug
sudo /usr/sbin/ModemManager --debug
- The previous steps works with the USB connection! There isn't any timeout when using usb
Thank you for your help, I hope someone can help me.