RAK2013 on RPi 4

Issue:
Hello all, yesterday I’ve installed succesfully my RAK2013 on my RPi 3B+.
Today I wanted to make it work on my RPi4. I’ve installed the rak2013_for_rpi sucessfully.
I’ve set the APN according to my SIM configuration, which is ‘internet’.
The module is not working as expected. I don’t see ppp0 interface showing up.

Here is the output :

[email protected]:~ $ sudo pppd call gprs
pppd options in effect:
debug # (from /etc/ppp/peers/gprs)
nodetach # (from /etc/ppp/peers/gprs)
dump # (from /etc/ppp/peers/gprs)
noauth # (from /etc/ppp/peers/gprs)
remotename 3gppp # (from /etc/ppp/peers/gprs)
/dev/ttyAMA0 # (from /etc/ppp/peers/gprs)
115200 # (from /etc/ppp/peers/gprs)
lock # (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet # (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect # (from /etc/ppp/peers/gprs)
nocrtscts # (from /etc/ppp/peers/gprs)
modem # (from /etc/ppp/peers/gprs)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/gprs)
novj # (from /etc/ppp/peers/gprs)
novjccomp # (from /etc/ppp/peers/gprs)
ipcp-accept-local # (from /etc/ppp/peers/gprs)
ipcp-accept-remote # (from /etc/ppp/peers/gprs)
ipparam 3gppp # (from /etc/ppp/peers/gprs)
noipdefault # (from /etc/ppp/peers/gprs)
ipcp-max-failure 30 # (from /etc/ppp/peers/gprs)
defaultroute # (from /etc/ppp/peers/gprs)
usepeerdns # (from /etc/ppp/peers/gprs)
noccp # (from /etc/ppp/peers/gprs)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
OK
– got it
send (ATE0^M)
expect (OK)
^M
^M
OK
– got it

send (ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
BG96^M
Revision: BG96MAR02A07M1G^M
^M
SubEdition: V08^M
^M
+CSQ: 99,99^M
^M
+COPS: 0^M
^M
+CGREG: 0,4^M
^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","internet",,0,0^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
 -- got it

Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 1346), status = 0x0
Serial connection established.
using channel 4
Using interface ppp0
Connect: ppp0 <--> /dev/ttyAMA0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x613ad4d7> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x9 <asyncmap 0x0> <auth chap MD5> <magic 0xd08a569f> <pcomp> <accomp>]
No auth is possible
sent [LCP ConfRej id=0x9 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x613ad4d7> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0xa <asyncmap 0x0> <magic 0xd08a569f> <pcomp> <accomp>]
sent [LCP ConfAck id=0xa <asyncmap 0x0> <magic 0xd08a569f> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0x613ad4d7]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP DiscReq id=0xb magic=0xd08a569f]
rcvd [LCP EchoRep id=0x0 magic=0xd08a569f 61 3a d4 d7]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [LCP EchoReq id=0x1 magic=0x613ad4d7]
IPCP: timeout sending Config-Requests
sent [LCP TermReq id=0x2 "No network protocols running"]
sent [LCP TermReq id=0x3 "No network protocols running"]
Connection terminated.
abort on (ERROR)
abort on (NO DIALTONE)
unterminated quote (line 4)
Script chat -s -v -f /etc/chatscripts/quectel-chat-disconnect finished (pid 1379), status = 0x1
disconnect script failed
Modem hangup

Any idea why it doesn’t keep the connection ?
Thanks

Actually, resetting the module with the reset button made it work…

[email protected]:~ $ sudo pppd call gprs
pppd options in effect:
debug # (from /etc/ppp/peers/gprs)
nodetach # (from /etc/ppp/peers/gprs)
dump # (from /etc/ppp/peers/gprs)
noauth # (from /etc/ppp/peers/gprs)
remotename 3gppp # (from /etc/ppp/peers/gprs)
/dev/ttyAMA0 # (from /etc/ppp/peers/gprs)
115200 # (from /etc/ppp/peers/gprs)
lock # (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet # (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect # (from /etc/ppp/peers/gprs)
nocrtscts # (from /etc/ppp/peers/gprs)
modem # (from /etc/ppp/peers/gprs)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/gprs)
novj # (from /etc/ppp/peers/gprs)
novjccomp # (from /etc/ppp/peers/gprs)
ipcp-accept-local # (from /etc/ppp/peers/gprs)
ipcp-accept-remote # (from /etc/ppp/peers/gprs)
ipparam 3gppp # (from /etc/ppp/peers/gprs)
noipdefault # (from /etc/ppp/peers/gprs)
ipcp-max-failure 30 # (from /etc/ppp/peers/gprs)
defaultroute # (from /etc/ppp/peers/gprs)
usepeerdns # (from /etc/ppp/peers/gprs)
noccp # (from /etc/ppp/peers/gprs)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
AT^M^M
OK
– got it

send (ATE0^M)
expect (OK)
^M
ATE0^M^M
OK
– got it

send (ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
BG96^M
Revision: BG96MAR02A07M1G^M
^M
SubEdition: V08^M
^M
+CSQ: 19,99^M
^M
+COPS: 0,0,“Sunrise Sunrise”,8^M
^M
+CGREG: 0,4^M
^M
OK
– got it

send (AT+CGDCONT=1,“IP”,“internet”,0,0^M)
expect (OK)
^M
^M
OK
– got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
– got it

Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 1037), status = 0x0
Serial connection established.
using channel 2
Using interface ppp0
Connect: ppp0 <–> /dev/ttyAMA0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x23cdb9bf> ]
rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <magic 0x9b684576> ]
No auth is possible
sent [LCP ConfRej id=0x0 ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x23cdb9bf> ]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9b684576> ]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x9b684576> ]
sent [LCP EchoReq id=0x0 magic=0x23cdb9bf]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP DiscReq id=0x2 magic=0x9b684576]
rcvd [LCP EchoRep id=0x0 magic=0x9b684576 23 cd b9 bf]
rcvd [IPCP ConfReq id=0x0]
sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 10.60.164.104> <ms-dns1 10.200.102.243> <ms-dns2 10.200.102.244>]
sent [IPCP ConfReq id=0x2 <addr 10.60.164.104> <ms-dns1 10.200.102.243> <ms-dns2 10.200.102.244>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfAck id=0x1]
rcvd [IPCP ConfAck id=0x2 <addr 10.60.164.104> <ms-dns1 10.200.102.243> <ms-dns2 10.200.102.244>]
Could not determine remote IP address: defaulting to 10.64.64.64
not replacing default route to wlan0 [192.168.0.3]
local IP address 10.60.164.104
remote IP address 10.64.64.64
primary DNS address 10.200.102.243
secondary DNS address 10.200.102.244
Script /etc/ppp/ip-up started (pid 1044)
Script /etc/ppp/ip-up finished (pid 1044), status = 0x0

1 Like

One more question @Nicholas : is there a command to close connection ? Once it’s up ?

Hello @laoky

The “sudo systemctl disalbe rak-pppd” command is to disable automatic dialing when the Raspberry Pi is turned on.

@ZhuQI Thanks for the quick answer. I am not sure however if I understand correctly. The lack of documentation is probably the main cause of all this confusion. I don’t understand what you mean by

automatic dialing

Should the RAK2013 automatically connect when the rpi boots up ?

  1. If yes, it is not the case here. I must always call sudo pppd call gprs to connect.
  2. If no, is it possible to do it ?

I’m sorry, I just made a mistake.

If you want to RAK2013 automatically connect when the rpi boots up, you need to execute the command sudo systemctl enable rak-pppd.

1 Like

@ZhuQI Thanks a lot, now I understand. However, if I launch the connection manually, is there a way to disconnect properly ?
I noticed that the module is not able to recover from bad disconnection (if i kill the process) even if i restart it with the reset button. I always have to reboot the pi in order to make it work again.

Are you using this code?

I just updated it.
If RAK2013 is disconnected, it will automatically reconnect after 1-2 minutes.

2 Likes

@ZhuQI Yes, I am using this.
Another question : connection is veeeeeeeeeeery slow. I know the BG96 is capable of way more speed. Can’t I increase the speed of the serial transmission ? I think this could be the current bottleneck ?

@ZhuQI

It’s still very weird that I have to reboot to get it work again. A simple reset should do the job… Can you have a look at it once ? We can call on Skype if you want to discuss more in details.
Thanks !

You can use the following commands to increase the speed of the serial.

  1. sudo minicom -D /dev/ttyAMA0 -b 115200

  2. Input “at+ipr=921600”

  3. exit minicom

  4. sudo minicom -D /dev/ttyAMA0 -b 921600

  5. Input “at&w”

1 Like

Done, thanks, it works fine. Can you have a look at my other question also ? About the reboot

I will reply you after using RAK2013.

1 Like

hello, i have to use RAK2013 ( i have both the BG96 and EG95-E) with my RPI4 ( i have also a RPI3B+) i tried all the firmware and tips that i found it in internet but when i run the service rak_ppp i don’t have an internet connection or i found a ppp in my ifconfig , i use the ConnectedYou sim card . any Help please ?

Greetings, when I try to increase the com port speed via these instructions, the modem will no longer connect. It times out waiting for the response from AT command. Changing it back to 115200 then it works. I’m using RPi 3b+

@thegpx Did you also change the script to communicate at 921600? I’m willing to bet that is your problem. I have over 50 of these running at 921600. I set the baud rate the same way that was described but also when have to recreate the connect scripts to use the correct baud as well.

Assuming you’re also using the code from github for your connection.

sudo /usr/local/rak/lte/ppp-creator.sh 'Your_sim_card_APN_name' ttyAMA0 921600

Then when you run

sudo pppd call gprs

you should be able to communicate with the modem just fine.