Reconnect after signal loss

I’m using a Quectel EC-25 in “stock form” on a Raspberry pi. It works, and looks just like an Ethernet port, but I have several issues: #1. Currently, the only way I know I have a connection is to ping So I sit in a loop waiting for a ping success, then move on to my application. I need to know if the 4G connection has failed. I could write a cron task to ping my “other end” to see if the connection is broken, but there must be a better way. So is there?
#2. How do I reconnect quickly after a signal loss? Is there an “AT” command that I could issue over the Ethernet port to reset the modem (continuously) until it reconnects? Or is there a mode that will automatically try to connect if the connection is dropped?

Run the modem in ECM mode. That gives full responsibility for maintaining the connection to the modem, with no other intervention required.

The modem becomes “hostless” in ECM mode.

I’ve run Quectels for over a year in ECM mode, with no apparent loss of connection.

You can read the current mode with AT+QCFG="usbnet" where a returned value of 0 means QMI, 1 means ECM and 2 means MBIM.

Set the mode using one ot those values, eg:


Thank YOU! I’ll try it.

I can’t find any information on ECM mode - or “usbnet” in the Quectel EC25 user manual. I have two EC25’s and I need both of them working, so I’m a bit reluctant to change these modules without knowing more about what I’m doing. Do you have any documentation on that mode?

One person on the forum commented that the EC25 module had to be registered on the network before this would work. This makes me unsure if I should try it, because I sometimes change carriers. My application is mobile, so I sometimes lose 4G signal and need to quickly re-establish it. In ECM mode, will it automatically reconnect to the carrier if the connection is lost without resetting the modem? And finally, if the connection is “connectionless” like UDP, can I get any confirmation that the modem is connected without pinging the other end?

I run an EC25-AU, EM06-E, EM12-G, RM500Q-AE and RM500Q-GL in ECM mode.

I freely change between QMI, ECM and MBIM modes as testing and development I do for the ROOter project dictates.

A hard reset (or power-cycle) is required after changing modes.

Documentation for this command is hard to find. I’m on a long road trip at present and don’t have access to the documentation I have at home.

That’s not quite right. With the correct APN, the modem will auto register. And it will also auto connect when in ECM mode.

I change often between SIMs from three different providers.

You would need to test that ECM mode works with all of your carriers. There have been reports of ECM mode not working with some carriers, and that’s an issue that should be taken up with Quectel engineers if it happens.

Yes. and almost instantly.

A ping is the most reliable test I know of.