ModemManager with UART

Hello community!!

I am working with Colibri IMX6ULL 512MB module and to compile I use Yocto-Project tdx-reference-minimal-image.

I want to use the Quectel BG95 module as an interface to connect to the internet using the ttymxc1 UART from imx6ull.

I was able to install ModemManager and NetworkManager, and also developed rules for ModemManager to detect the bg95 over UART.

Here share the rules.

ACTION!="add|change|move|bind", GOTO="mm_bg95_uart2_end"
SUBSYSTEMS=="tty", DEVPATH=="/sys/devices/platform/soc/2100000.bus/21e8000.serial"
LABEL="mm_bg95_uart2_end"

# Rule for ModemManager to handle the device on ttymxc1
ACTION=="add|change|move", SUBSYSTEM=="tty", KERNEL=="ttymxc1", ENV{ID_MM_DEVICE_PROCESS}="1", ENV{ID_MM_TTY_BAUDRATE}="115200", ENV{ID_MM_PORT_TYPE_AT_PPP}="1", ENV{ID_MM_TTY_FLOW_CONTROL}="rts-cts"

Following the next steps Modem Support | Toradex Developer Center

ModemManager recognized the module bg95 and successfully enabled the modem.

The problem is when I want to create a new connection with NetworkManager.

nmcli c add type gsm ifname ttymxc1 con-name home apn igprs.claro.com.ar

The bg95 module responds CONNECT, and I understand that the PPP protocol is activated in the module.

Afterwards, ModemManager sends other commands, but the bg95 module is using UART.

With the command nmcli d and mmcli -m 0, it shows me the status of the module as CONNECTING.

But the connection is established, because after executing

mmcli -m 0 --simple-connect="apn=igprs.claro.com.ar"

error: couldn’t find modem

Can you help me with this?

Hello @facundo.n.r !

The error error: couldn’t find modem normally means that the incorrect ID is used, can you please check if you are using the correct ID? You can find it executing mmcli -L.

Also, after adding the GSM connection, executing nmcli r wwan on should be enough to make it work, can you please try to implement it and send us the output of the nmcli device status command?

Please let me know if you have any doubts.

Best regards,
Daniel Morais

Hi @daniel_m.tx ! thanks for your reply

Yes, I use the correct ID, here I show you.

When I add the GSM connection, NetworkManager connects the GSM module, at this time it is in PPP mode, therefore the uart port cannot send AT commands.

Here I share with you a photo of the entire process.

Here whit a spy FTDI, I can see the process of the before command

For a moment, the nmcli device status shows me the device’s gsm connection ttymxc1.
Then it disconnects and commands mmcli -L return No modems were found.

journalctl

May 03 17:21:11 colibri-imx6ull-14938795 ModemManager[396]: <error> [modem0] port ttymxc1 timed out 10 consecutive times, marking modem as invalid
May 03 17:21:11 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714756871.6889] device (ttymxc1): state change: prepare -> unmanaged (reason 'removed', sys-iface-state: 'removed')
May 03 17:21:11 colibri-imx6ull-14938795 NetworkManager[397]: <warn>  [1714756871.7580] modem-broadband[ttymxc1]: failed to disconnect modem: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/org/freedesktop/ModemManager1/Modem/0”
May 03 17:21:11 colibri-imx6ull-14938795 ModemManager[396]: <warn>  [modem0/bearer1] connection attempt #1 failed: AT command was cancelled
May 03 17:21:11 colibri-imx6ull-14938795 ModemManager[396]: <info>  [modem0/bearer1] connection #1 finished: duration 0s, tx: 0 bytes, rx: 0 bytes
May 03 17:22:10 colibri-imx6ull-14938795 wpa_supplicant[441]: uap0: CTRL-EVENT-SCAN-FAILED ret=-16
May 03 17:23:58 colibri-imx6ull-14938795 systemd-networkd[203]: mlan0: Link DOWN
May 03 17:23:58 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757038.7102] device (mlan0): set-hw-addr: set MAC address to 16:D6:CA:75:4B:8B (scanning)
May 03 17:23:58 colibri-imx6ull-14938795 systemd-networkd[203]: mlan0: Link UP
May 03 17:23:58 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757038.7310] device (mlan0): supplicant interface state: inactive -> interface_disabled
May 03 17:23:58 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757038.7473] device (mlan0): supplicant interface state: interface_disabled -> inactive
May 03 17:24:11 colibri-imx6ull-14938795 systemd-networkd[203]: uap0: Link DOWN
May 03 17:24:11 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757051.9362] device (uap0): set-hw-addr: set MAC address to C6:A1:63:32:EC:B8 (scanning)
May 03 17:24:11 colibri-imx6ull-14938795 systemd-networkd[203]: uap0: Link UP
May 03 17:24:12 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757052.3250] device (uap0): supplicant interface state: inactive -> interface_disabled
May 03 17:24:12 colibri-imx6ull-14938795 NetworkManager[397]: <info>  [1714757052.3365] device (uap0): supplicant interface state: interface_disabled -> inactive
May 03 17:24:12 colibri-imx6ull-14938795 wpa_supplicant[441]: uap0: CTRL-EVENT-SCAN-FAILED ret=-16

Hi @facundo.n.r ,

Sorry for the delay to answer.

Were you able to advance with this issue? If not, can you please share the entire dmesg log?

Best regards,
Daniel Morais