I have a Python script that sends AT commands over the serial port /dev/ttySC0 to the SARA-R422M8S-00B u-blox module.
Here are the commands:
gprs_cmds = [
'+++',
'&K0',
'Z',
'',
'+CFUN=0',
'+CPSMS=0',
'+UMNOPROF=100',
'+CFUN=16',
'+UMNOPROF?',
'+CFUN=0',
'+URAT=9',
'+URAT?',
'+CFUN=16',
'+URAT?',
'+CFUN=0',
'+CGDCONT=1,"IP","{}","0.0.0.0",0,0'.format(ISP['apn']),
'+UAUTHREQ=1,2,"{}","{}"'.format(ISP['username'], ISP['password']),
'+CFUN=15',
'+CGATT=1',
'+CGACT=1,1',
'+CGDCONT?',
'+CGATT?',
'+CGACT?',
'+CGPADDR',
'+CGREG?',
'+CSQ',
'D{}'.format(ISP['phone_number']),
]
If at any point an AT command doesn't receive a response within 200 milliseconds, it is sent again, up to 10 times.
So far, everything is fine. I manage to send all the AT commands and receive their responses until "OK\r\n". Finally, when I send ATD99**1#, I receive the final "CONNECT 150000000".
The problem arises later when I call pppd with the following options:
"sudo pppd debug nodetach maxfail 0 dump noauth nocrtscts user {} password {} {} {} modem asyncmap 0 default-mru mtu 1500 lcp-echo-failure 3 lcp-echo-interval 10 ipcp-accept-local ipcp-accept-remote noipdefault ipcp-restart 10 ipcp-max-configure 30 ipcp-max-failure 10 defaultroute replacedefaultroute noipv6 usepeerdns.format(ISP['username'], ISP['password'], serial_port, baud_rate)"
My problem is that once I manage to establish a connection with the ppp0 interface, it immediately disconnects again, and I can never get it to stay stable. The messages that appear immediately after the connection are: [b]rcvd [LCP TermReq id=0x3] LCP terminated by peer Connect time 0.0 minutes. (...)
May 17 10:10:36 raspberrypi pppd[4018]: CHAP authentication succeeded
May 17 10:10:36 raspberrypi pppd[4018]: CHAP authentication succeeded
May 17 10:10:36 raspberrypi pppd[4018]: sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
May 17 10:10:36 raspberrypi pppd[4018]: sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
May 17 10:10:36 raspberrypi pppd[4018]: rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
May 17 10:10:36 raspberrypi pppd[4018]: Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
May 17 10:10:37 raspberrypi pppd[4018]: rcvd [IPCP ConfReq id=0x0]
May 17 10:10:37 raspberrypi pppd[4018]: sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
May 17 10:10:37 raspberrypi pppd[4018]: rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
May 17 10:10:37 raspberrypi pppd[4018]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
May 17 10:10:38 raspberrypi pppd[4018]: rcvd [IPCP ConfReq id=0x1]
May 17 10:10:38 raspberrypi pppd[4018]: sent [IPCP ConfAck id=0x1]
May 17 10:10:38 raspberrypi pppd[4018]: rcvd [IPCP ConfNak id=0x2 <addr 10.114.191.102> <ms-dns1 10.4.0.240> <ms-dns2 10.4.0.230>]
May 17 10:10:38 raspberrypi pppd[4018]: sent [IPCP ConfReq id=0x3 <addr 10.114.191.102> <ms-dns1 10.4.0.240> <ms-dns2 10.4.0.230>]
May 17 10:10:38 raspberrypi pppd[4018]: rcvd [IPCP ConfAck id=0x3 <addr 10.114.191.102> <ms-dns1 10.4.0.240> <ms-dns2 10.4.0.230>]
May 17 10:10:38 raspberrypi pppd[4018]: Could not determine remote IP address: defaulting to 10.64.64.64
May 17 10:10:38 raspberrypi pppd[4018]: Script /etc/ppp/ip-pre-up started (pid 4035)
May 17 10:10:38 raspberrypi pppd[4018]: Script /etc/ppp/ip-pre-up finished (pid 4035), status = 0x0
May 17 10:10:38 raspberrypi pppd[4018]: replacing old default route to wlan0 [192.168.1.1]
May 17 10:10:38 raspberrypi pppd[4018]: del old default route ioctl(SIOCDELRT): No such process(3)
May 17 10:10:38 raspberrypi pppd[4018]: local IP address 10.114.191.102
May 17 10:10:38 raspberrypi pppd[4018]: remote IP address 10.64.64.64
May 17 10:10:38 raspberrypi pppd[4018]: primary DNS address 10.4.0.240
May 17 10:10:38 raspberrypi pppd[4018]: secondary DNS address 10.4.0.230
May 17 10:10:38 raspberrypi pppd[4018]: updetach is set. Now detaching.
May 17 10:10:38 raspberrypi pppd[4038]: Script /etc/ppp/ip-up started (pid 4039)
May 17 10:10:38 raspberrypi avahi-daemon[312]: Got SIGHUP, reloading.
May 17 10:10:38 raspberrypi avahi-daemon[312]: No service file found in /etc/avahi/services.
May 17 10:10:38 raspberrypi pppd[4038]: Script /etc/ppp/ip-up finished (pid 4039), status = 0x0
May 17 10:10:38 raspberrypi pppd[4038]: rcvd [LCP TermReq id=0x3]
May 17 10:10:38 raspberrypi pppd[4038]: LCP terminated by peer
May 17 10:10:38 raspberrypi pppd[4038]: Connect time 0.0 minutes.
May 17 10:10:38 raspberrypi pppd[4038]: Sent 0 bytes, received 0 bytes.
May 17 10:10:38 raspberrypi pppd[4038]: Script /etc/ppp/ip-down started (pid 4110)
May 17 10:10:38 raspberrypi pppd[4038]: sent [LCP TermAck id=0x3]
May 17 10:10:38 raspberrypi avahi-daemon[312]: Got SIGHUP, reloading.
May 17 10:10:38 raspberrypi avahi-daemon[312]: No service file found in /etc/avahi/services.
May 17 10:10:38 raspberrypi pppd[4038]: Script /etc/ppp/ip-down finished (pid 4110), status = 0x0
May 17 10:10:41 raspberrypi pppd[4038]: Connection terminated.
May 17 10:10:42 raspberrypi pppd[4038]: Modem hangup
May 17 10:10:42 raspberrypi pppd[4038]: Exit.
Has anyone else experienced the same issue as me? Is there any AT command that I might be overlooking? Or could it be a parameter in pppd? Or perhaps a network problem?
Thank you in advance,