OpenWrt Forum Archive

Topic: Having problem to reconnect modem after going down

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I have to Chinese routers which are similar and both have Ericsson F5521gw
modem inside. I am having trouble with both of them, disconnection at what appears to be random times then being unable to reconnect again.

I am currently running Bleeding Edge, r41336 and the modems go up an running without problems after hard restart:

Tue Aug  5 09:45:20 2014 user.emerg syslog: Waiting for Registration..(120 sec max)........
Tue Aug  5 09:45:21 2014 user.emerg syslog: Registered on Home network: "Telenor SE",2 
Tue Aug  5 09:45:21 2014 user.emerg syslog: Signal Quality: 99,99
Tue Aug  5 09:45:22 2014 daemon.notice netifd: Interface '3G' is now down
Tue Aug  5 09:45:22 2014 daemon.notice netifd: Interface '3G' is setting up now
Tue Aug  5 09:45:22 2014 user.emerg syslog: setting up led USB
Tue Aug  5 09:45:22 2014 user.emerg syslog: - init complete -
Tue Aug  5 09:45:25 2014 daemon.notice netifd: 3G (1111): SIM ready
Tue Aug  5 09:45:25 2014 daemon.notice netifd: 3G (1111): PIN set successfully
Tue Aug  5 09:45:25 2014 daemon.notice pppd[1141]: pppd 2.4.6 started by root, uid 0
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: abort on (BUSY)
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: abort on (NO CARRIER)
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: abort on (ERROR)
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: report (CONNECT)
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: timeout set to 10 seconds
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: send (AT&F^M)
Tue Aug  5 09:45:26 2014 local2.info chat[1144]: expect (OK)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: AT&F^M^M
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: OK
Tue Aug  5 09:45:27 2014 local2.info chat[1144]:  -- got it
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: send (ATE1^M)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: expect (OK)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: ^M
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: ATE1^M^M
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: OK
Tue Aug  5 09:45:27 2014 local2.info chat[1144]:  -- got it
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: send (AT+CGDCONT=1,"IP","internet.telenor.se"^M)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: timeout set to 30 seconds
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: expect (OK)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: ^M
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: AT+CGDCONT=1,"IP","internet.telenor.se"^M^M
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: OK
Tue Aug  5 09:45:27 2014 local2.info chat[1144]:  -- got it
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: send (ATD*99#^M)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: expect (CONNECT)
Tue Aug  5 09:45:27 2014 local2.info chat[1144]: ^M
Tue Aug  5 09:45:28 2014 local2.info chat[1144]: ATD*99#^M~^?}#@!}!}!} }9}#}%B#}%}(}"}'}"}"}&} } } } }%}&}6"r IA~^M
Tue Aug  5 09:45:28 2014 local2.info chat[1144]: CONNECT
Tue Aug  5 09:45:28 2014 local2.info chat[1144]:  -- got it
Tue Aug  5 09:45:28 2014 local2.info chat[1144]: send ( ^M)
Tue Aug  5 09:45:28 2014 daemon.info pppd[1141]: Serial connection established.
Tue Aug  5 09:45:28 2014 daemon.info pppd[1141]: Using interface 3g-3G
Tue Aug  5 09:45:28 2014 daemon.notice pppd[1141]: Connect: 3g-3G <--> /dev/ttyACM0
Tue Aug  5 09:45:29 2014 daemon.info pppd[1141]: CHAP authentication succeeded: Congratulations!
Tue Aug  5 09:45:29 2014 daemon.notice pppd[1141]: CHAP authentication succeeded
Tue Aug  5 09:45:32 2014 daemon.warn pppd[1141]: Could not determine remote IP address: defaulting to 10.64.64.64
Tue Aug  5 09:45:32 2014 daemon.notice pppd[1141]: local  IP address 46.195.239.18
Tue Aug  5 09:45:32 2014 daemon.notice pppd[1141]: remote IP address 10.64.64.64
Tue Aug  5 09:45:32 2014 daemon.notice pppd[1141]: primary   DNS address 195.54.122.221
Tue Aug  5 09:45:32 2014 daemon.notice pppd[1141]: secondary DNS address 195.54.122.211
Tue Aug  5 09:45:32 2014 daemon.notice netifd: Network device '3g-3G' link is up
Tue Aug  5 09:45:32 2014 daemon.notice netifd: Interface '3G' is now up
Tue Aug  5 09:45:32 2014 user.notice firewall: Reloading firewall due to ifup of 3G (3g-3G)
Tue Aug  5 09:45:35 2014 daemon.info dnsmasq[1033]: reading /tmp/resolv.conf.auto
Tue Aug  5 09:45:35 2014 daemon.info dnsmasq[1033]: using local addresses only for domain lan
Tue Aug  5 09:45:35 2014 daemon.info dnsmasq[1033]: using nameserver 195.54.122.221#53
Tue Aug  5 09:45:35 2014 daemon.info dnsmasq[1033]: using nameserver 195.54.122.211#53
Tue Aug  5 09:51:13 2014 daemon.info pppd[1141]: System time change detected.

And I have written a cron job that every 5th minute goes in, tries t download a webpage, and if the download was unsuccessful, try to reconnect with command:

gcom -g /dev/ttyACM1

which it seems using this command like wakes the modem up and

ifup 3G

to connect the the modem.
When the modem goes down, a soft reboot doesn't help, then the modem is still unable to connect to the net, but running gcom-command says that the modem is registers with the service provider and give me a good signal quality.
In the systemlog, it says the same thing as when it connects to the net only after the whole procedure, it says

Mon Jul 21 12:25:28 2014 user.emerg syslog:  ***SIM ERROR***
Mon Jul 21 12:25:28 2014 user.emerg syslog: Check device port configuration.
Mon Jul 21 12:25:28 2014 user.emerg syslog: Check SIM is inserted
Mon Jul 21 12:25:28 2014 user.emerg syslog: Test SIM in a mobile phone?
Mon Jul 21 12:25:29 2014 daemon.info pppd[1035]: Terminating on signal 15
Mon Jul 21 12:25:29 2014 daemon.info pppd[1035]: Connect time 0.4 minutes.
Mon Jul 21 12:25:29 2014 daemon.info pppd[1035]: Sent 6363 bytes, received 40667 bytes.
Mon Jul 21 12:25:29 2014 daemon.notice netifd: Network device '3g-3G' link is down
Mon Jul 21 12:25:29 2014 daemon.notice pppd[1035]: Connection terminated.
Mon Jul 21 12:25:29 2014 user.emerg syslog: setting up led USB
Mon Jul 21 12:25:29 2014 daemon.info pppd[1035]: Exit.
Mon Jul 21 12:25:29 2014 daemon.notice netifd: Interface '3G' is now down

I've tried different services providers here in Sweden (Tre and Telenor) and since I do not have any other problems when using other modems, the Ericsson modems most be the issue.

I've read about many people having similar problems when running on Windows.
But since this modem is quite common, I was wondering if anyone else have had a look at this problem.

(Last edited by solliq on 5 Aug 2014, 09:06)

gcom  use script where it set on modem AT+CFUN=1, you can try to set modem AT+CFUN=4 and after 10s try to set back AT+CFUN=1, maybe it helps. Or find some gpio which respond for power on modem, if device have this.

I will try this and get back to you with results, sounds promising since the connect is up and running again after a hard restart i.e. unpluggning and then repluggning the router.

I tried the suggestion, running the command:

echo "AT+CFUN=4" > /dev/ttyACM0

waiting 10 seconds or so then running the command

echo "AT+CFUN=1" > /dev/ttyACM0

It seems it didn't work, do now know what is wrong but I can not verify that the command has been accepted by the modem.

When looking into the log when trying to reconnect the modem it looks something like this:

Tue Aug  5 09:45:28 2014 daemon.info pppd[1141]: Serial connection established.
Tue Aug  5 09:45:28 2014 daemon.info pppd[1141]: Using interface 3g-3G
Tue Aug  5 09:45:28 2014 daemon.notice pppd[1141]: Connect: 3g-3G <--> /dev/ttyACM0
Tue Aug  5 09:45:29 2014 daemon.info pppd[1141]: CHAP authentication succeeded: Congratulations!
Tue Aug  5 09:45:29 2014 daemon.notice pppd[1141]: CHAP authentication succeeded

then nothing else, but there is no connection registered.

I also tried to change the modem to a used one I bought, a Ericsson F3507g, I think the name is but seems the problem remains.

Since the problem is no with the modem itself it seems, I will try to change the topic to something more relatable.

sometimes standard echo cannot send command without new row character.

echo "AT+CFUN=4\015" > /dev/ttyACM0

Or find AT command witch can reload modem.

Did you found GPIO responded to USB/PCIe power?

Hmm it seems to be working now with the command you listed neryba, using

echo "AT+CFUN=4" > /dev/ttyACM0

hangs up the modem but after a couple of seconds the router tries to reconnect again which I can only assume is equal to the command

echo "AT+CFUN=1" > /dev/ttyACM0

but i could see some troubles with the reconnect as well, I will test a bit so see if the modem actually succeds in connecting after running CFUN=4 or if I have to run the command CFUN=1 before.

So the only way to achieve a hard reboot of the modem itself would be to turn of the GPIO as suggested.

I do not know how to look for which GPIO the modem is connected to though, how is that localized?

EDIT:

By using the commands CFUN=4 to hang up the modem, the router will try to reconnect and it seems it wont be able to do so until I run the command CFUN=1 again.
Maybe next time the modem hangs up by itself, I can run the command CFUN=1 directly.

(Last edited by solliq on 7 Aug 2014, 11:27)

I made a cron job that checks if i could wget google.com and if not, tries to run the commands discussed above.
It seems to be working, at least better then before since the internet was working even after a couple weekend and no resetting.

I will get back with more information in the near future if something else occurs.

After 4.5 days the router worked nice, reconnecting each time it dropped connection but today the router would just not manage to reconnect itself again.

It tried several times to reconnect and maybe it would succeed in the end but I did a hard reset and the connection was up and running again.

I would like to know which GPIO and how to set the GPIO status so I can adjust the previously made cron job to turn on and off the modem instead.

I assume the command to change the GPIO status is:

echo 1 > {something to GPIO}

yes, you need test all free gpios. all reserved you can see

cat /sys/kernel/debug/gpio

and try all free with ex gpio12

echo 12 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio12/direction
echo 1 > /sys/class/gpio/gpio12/value
#wait some time
echo 0 > /sys/class/gpio/gpio12/value

The discussion might have continued from here.