OpenWrt Forum Archive

Topic: PPP interface in OpenWRT using Sim800L GSM Modem

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

Hi All,

I want to make a PPP interface using Sim800L GSM Modem connected through UART.

I am using MT7688 (LinkIt Smart 7688) where OpenWRT runs.

Please help me out making PPP interface or dial-up connection in openwrt.

Hello. How You make this?
I read this link, but interface not up.

I set pincode on SIM card to 0000 (default pincode) and disabled SIM card blocking via mobile phone.

/etc/config/network:

config interface 'wan3g'
        option ifname 'ppp0'
        option proto '3g'
        option device '/dev/ttyS0'
        option apn 'internet'
        option username 'gdata'
        option password 'gdata'
        option dialnumber '*99***1#'
        option service 'umts'
        #option pincode ''

# logread:

Sat Jan  7 08:41:26 2017 daemon.notice netifd: Interface 'wan3g' is setting up now
Sat Jan  7 08:41:28 2017 daemon.notice pppd[1390]: pppd 2.4.7 started by root, uid 0
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: abort on (BUSY)
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: abort on (NO CARRIER)
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: abort on (ERROR)
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: report (CONNECT)
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: timeout set to 10 seconds
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: send (AT&F^M)
Sat Jan  7 08:41:29 2017 local2.info chat[1392]: expect (OK)
Sat Jan  7 08:41:39 2017 local2.info chat[1392]: alarm
Sat Jan  7 08:41:39 2017 local2.info chat[1392]: Failed
Sat Jan  7 08:41:39 2017 daemon.err pppd[1390]: Connect script failed
Sat Jan  7 08:41:40 2017 daemon.info pppd[1390]: Exit.
Sat Jan  7 08:41:40 2017 daemon.notice netifd: Interface 'wan3g' is now down
Sat Jan  7 08:41:40 2017 daemon.notice netifd: Interface 'wan3g' is setting up now
Sat Jan  7 08:41:41 2017 daemon.notice pppd[1412]: pppd 2.4.7 started by root, uid 0
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: abort on (BUSY)
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: abort on (NO CARRIER)
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: abort on (ERROR)
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: report (CONNECT)
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: timeout set to 10 seconds
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: send (AT&F^M)
Sat Jan  7 08:41:42 2017 local2.info chat[1414]: expect (OK)
Sat Jan  7 08:41:52 2017 local2.info chat[1414]: alarm
Sat Jan  7 08:41:52 2017 local2.info chat[1414]: Failed
Sat Jan  7 08:41:52 2017 daemon.err pppd[1412]: Connect script failed
Sat Jan  7 08:41:53 2017 daemon.info pppd[1412]: Exit.
Sat Jan  7 08:41:53 2017 daemon.notice netifd: Interface 'wan3g' is now down
...

# ifstatus wan3g:

{
        "up": false,
        "pending": true,
        "available": true,
        "autostart": true,
        "proto": "3g",
        "data": {

        }
}

if I enabled SIM card blocking:

/etc/config/network:

config interface 'wan3g'
        option ifname 'ppp0'
        option proto '3g'
        option device '/dev/ttyS0'
        option apn 'internet'
        option username 'gdata'
        option password 'gdata'
        option dialnumber '*99***1#'
        option service 'umts'
        option pincode '0000'

# ifstatus wan3g:

{
        "up": false,
        "pending": false,
        "available": true,
        "autostart": false,
        "proto": "3g",
        "data": {

        },
        "errors": [
                {
                        "subsystem": "3g",
                        "code": "PIN_FAILED"
                }
        ]
}

0000 is a real pincode. I type it on mobile phone start.

Please help me.

OpenWRT is CHAOS CALMER (15.05, r46767).
Mikrotik RB951Ui 2HnD
Mobile provider is Megafon.

Also I disabled UART console and reset terminal to RAW mode:

/etc/sysctl.conf wrote:
kernel.printk = 0 4 1 7

/etc/inittab wrote:
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
#::askconsole:/bin/ash --login

etc/rc.local wrote:
stty -F /dev/ttyS0 4:0:18b2:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

(Last edited by vnt-83 on 7 Jan 2017, 07:55)

Hi

PIN is not mandatory...No need to include the same....

Can you try without user name , password, PIN etc.,?

Dial number is correct?

Yes, I try without username, password, PIN. Connection not work.

config interface 'wan3g'
        option ifname 'ppp0'
        option proto '3g'
        option device '/dev/ttyS0'
        option apn 'internet'
        option username ''
        option password ''
        option dialnumber '*99#'
        option service 'umts'
#       option pincode '0000'

Although through the AT command module calls on my phone. Maybe module is defective? I will check GET requests via AT commands.

I added wan3g interface via luci. Could I miss something? Different kmod-usb-serial modules do not need me, right?

I try *99# and *99***1#. Now I will try without dial number.

you can comment the username and password...

Dial number and apn is very important it should match with the GSM service provider details of the corresponding SIM you are using...

Dial number and apn is ok.

Through the AT commands GET requests works correctly.

It is seen (via cat /dev/ttyS0) that the module sends the information not correctly.

Must be like this:

AT+CIPSEND=27
ERROR
AT*CIPSTART="TCP","site.com",80
OK

CONNECT OK

AT+CFTN=1
OK
AT+CPIN>
+CPIN: READY

OK
AT+CSTT<"internet","",""
OK

Actually as follows:

AT+CIPREND=26
ERRNR
AT*CIPST@RT="TBP","site.com",80
OK

CONNECT NK

AT+CFTN=1
NK
AT+CPIN>
+CPHN: RE@DY

OK
AT+CSTT<"internet","",""
NK

I think this may be the cause. What could it be?

(Last edited by vnt-83 on 7 Jan 2017, 10:31)

can you share the chat script?

Yes. I do not edit it.

# cat /etc/chatscripts/3g.chat
ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD$DIALNUMBER"
CONNECT ' '

I manually entered all AT commands from this script. And I got as a result the success message.

# echo "AT&F" > /dev/ttyS0
# echo "ATE1" > /dev/ttyS0
# echo "AT+CGDCONT=1,\"IP\",\"internet\"" > /dev/ttyS0
# echo "ATD*99#" > /dev/ttyS0


# cat /dev/ttyS0
AT&F
OK

ATE1
OK

AT+CGDCONT=0,"IP","internet"
OJ
ATD*99#
BONNECT

I am confused by the wrong display from cat /dev/ttyS0. Here is part of the result of a GET request:

codebase="http:/.downlnad.mabromedha.com.pub/shockwave/cabr/flash/swfl`sh.cab#vershon=9,0,18,0"

It seems that different settings have UART and serial port of module.

(Last edited by vnt-83 on 7 Jan 2017, 12:31)

I enabled debug in /etc/ppp/options and get new line in logread:

daemon.debug pppd[3626]: Script USE_APN=internet DIALNUMBER=*99# /usr/sbin/chat -t5 -v -E -f /etc/chatscripts/3g.chat finished (pid 3627), status = 0x3
# cat /etc/ppp/options
debug
logfile /dev/null
noipdefault
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 5
lcp-echo-interval 1

Full log:

Sat Jan  7 17:40:45 2017 daemon.notice netifd: Interface 'wan3g' is setting up now
Sat Jan  7 17:40:47 2017 daemon.notice pppd[4646]: pppd 2.4.7 started by root, uid 0
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: abort on (BUSY)
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: abort on (NO CARRIER)
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: abort on (ERROR)
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: report (CONNECT)
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: timeout set to 10 seconds
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: send (AT&F^M)
Sat Jan  7 17:40:48 2017 local2.info chat[4651]: expect (OK)
Sat Jan  7 17:40:58 2017 local2.info chat[4651]: alarm
Sat Jan  7 17:40:58 2017 local2.info chat[4651]: Failed
Sat Jan  7 17:40:58 2017 daemon.debug pppd[4646]: Script USE_APN=internet DIALNUMBER=*99# /usr/sbin/chat -t5 -v -E -f /etc/chatscripts/3g.chat finished (pid 4650), status = 0x3
Sat Jan  7 17:40:58 2017 daemon.err pppd[4646]: Connect script failed
Sat Jan  7 17:40:59 2017 daemon.info pppd[4646]: Exit.
Sat Jan  7 17:40:59 2017 daemon.notice netifd: Interface 'wan3g' is now down

(Last edited by vnt-83 on 7 Jan 2017, 15:45)

The discussion might have continued from here.