RPi connection to internet via 4/5G connection

Hi Team.

I have a project that I have been working on for way too long!

The latest headache presented is connecting a Raspberry Pi to the internet via 4/5G network.

I purchased a TOPHAT for a Pi in which I can place a SIM card (I purchased a DATA only card).

I have followed many tutorials, youtubes, wiki instructions all of which have something extra to add to the puzzle, none of which have worked!

What HAT would people reccommend for this application? It doesnt really need GPS but that would be a bonus although is seems that GPS functionality and anything else can not happen concurrently so it kind of make this redundant.

The one I have (not mentioning brand or model for a reason so that I get a broader response) seems dodgy as even the GPS functionality is very much a hit and miss affair (with a PC. Non existant results using a Pi - I have tried several Pi’s si I can rule out a faulty Pi).

This whole affair once develpoed will need to stand isolated from any wired services, hence the need for 4/5G connection.

A penny for anyones thoughts!

2 Likes

Update…

Using Get Started with Super SIM, the Raspberry Pi 4 and the Waveshare 4G Hat | Twilio as a guide I have been able to get this far… and needing to have the HAT disconnected from the RPi so that I can get ttyUSB2 listed in … “ls /dev/tty*”… A modem hangup.

XXXXXXXXXXXXXXX:~ $ sudo pon
abort on (BUSY)
abort on (VOICE)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (NO DIAL TONE)
abort on (NO ANSWER)
abort on (DELAYED)
abort on (ERROR)
abort on (+CGATT: 0)
send (AT^M)
timeout set to 12 seconds
expect (OK)
AT^M^M
OK
– got it

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

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

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

send (ATD99#^M)
timeout set to 22 seconds
expect (CONNECT)
^M
ATD
99#^M^M
CONNECT
– got it

send (^M)
Script /usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super finished (pid 4541), status = 0x0
Serial connection established.
using channel 53
Using interface ppp0
Connect: ppp0 ↔ /dev/ttyUSB2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xef7e9554> ]
rcvd [LCP ConfReq id=0xce <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP ConfNak id=0xce ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xef7e9554> ]
rcvd [LCP ConfReq id=0xcf <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP ConfAck id=0xcf <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP EchoReq id=0x0 magic=0xef7e9554]
sent [PAP AuthReq id=0x1 user=“myusername@realm” password=]
rcvd [LCP DiscReq id=0xd0 magic=0x7733871f]
rcvd [LCP EchoRep id=0x0 magic=0x7733871f ef 7e 95 54]
rcvd [PAP AuthAck id=0x1 “”]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
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>]
sent [IPV6CP ConfReq id=0x1 ]
rcvd [LCP ProtRej id=0xd1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received
rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Modem hangup
Connection terminated.
Any ideas?

Hi @Kym252504

I’ve trawled the waveshare FAQ Page for this device but haven’t uncovered anything gratifying.

It looks like this is where things are coming undone.

Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received

Which led me to this stack overflow thread where a user suggests the carrier is rejecting the connection, and disabling compression.

Do you have documentation that covers the following commands that preceded the Protocol-Reject message?
For clarity, they are:

sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
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>]
sent [IPV6CP ConfReq id=0x1 ]
Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received

Hi Michael.

Thank you for your response.

I too saw this and spent most of the afternoon trying to work out how to turn compression off… no luck, but with a bit of a break and asking the question a different way, i may have stumbled across something…

https://forums.raspberrypi.com/viewtopic.php?t=351584
“I’d start by disabling compression in pppd, e.g. ‘bsdcomp 0’, see the pppd man page entry for details. Sadly there are a large number of variables in a PPP connection like this, and it may take quite a bit of trial-and-error to get it working.”

One of the other issues is that i cant find half of the folders/files everyone refers to. ppp0 does not appear in ifconfig dump, basically Bootlace has shifted everything and has new folder names for everything. Most frustrating! When Im looking for something in a file I tend to COPY/PASTE into a word doc and then use search features…

I will see what transpires tomorrow.

Thanks again for your input into my problem…

Cheers.

Okies…
So I added
bsdcom 0
noccp
to the bottom of /etc/ppp/options file and disabled anything that was associated with compression .

Now I get this… but no compression errors.

xxxxxxxxxxxx:~ $ sudo pon
abort on (BUSY)
abort on (VOICE)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (NO DIAL TONE)
abort on (NO ANSWER)
abort on (DELAYED)
abort on (ERROR)
abort on (+CGATT: 0)
send (AT^M)
timeout set to 12 seconds
expect (OK)
AT^M^M
OK
– got it

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

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

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

send (ATD99#^M)
timeout set to 22 seconds
expect (CONNECT)
^M
ATD
99#^M^M
CONNECT
– got it

send (^M)
Script /usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super finished (pid 2616), status = 0x0
Serial connection established.
using channel 2
Using interface ppp0
Connect: ppp0 ↔ /dev/ttyUSB2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xd66a0c49>]
rcvd [LCP ConfReq id=0x4 <asyncmap 0x0> <magic 0x7c1c49f5> ]
sent [LCP ConfRej id=0x4 ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xd66a0c49>]
rcvd [LCP ConfReq id=0x5 <asyncmap 0x0> <magic 0x7c1c49f5>]
sent [LCP ConfNak id=0x5 ]
rcvd [LCP ConfReq id=0x6 <asyncmap 0x0> <magic 0x7c1c49f5>]
sent [LCP ConfAck id=0x6 <asyncmap 0x0> <magic 0x7c1c49f5>]
sent [LCP EchoReq id=0x0 magic=0xd66a0c49]
sent [PAP AuthReq id=0x1 user=“myusername@realm” password=]
rcvd [LCP DiscReq id=0x7 magic=0x7c1c49f5]
rcvd [LCP EchoRep id=0x0 magic=0x7c1c49f5 d6 6a 0c 49]
rcvd [PAP AuthAck id=0x1 “”]
PAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPV6CP ConfReq id=0x1 ]
rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Modem hangup
Connection terminated.

image
This is all I get from a ifconfig…
From what documentation i have found, there should be a ppp0 entry… No idea how to get one there…a re-install of ppp does nothing but report latest version already installed…

1 Like

Step by step eh? Sounds like people find themselves on a similar journey with this kind of hardware…

From this post the replied suggests that:

This looks like APN conflict. Check your PDP context → are you using default PDP context e.g. 1 or something else e.g. 3? I faced similar issues and it turned out that there were multiple APNs (default and non default) conflicting resulting in cell provider kicking out the connection (LCP terminated by peer).

THis other troubleshooting resource points to incorrect APN configuration as a reason for spurious hangups too.

Modem hang up and you tried all solution, nothing work and do not know why

I have encountered few time on this problem, it hang up while connecting to network.
Because of incorrect APN, try all APN you can find on network and in your phone’s setting. To change the APN, edit /etc/ppp/peers/provider

The full config file including all of the rubbish from testing.

This was the critical 2 lines, what was and what it needed to be. Hope this helps someone else.

#connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super'
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T telstra.internet'

Thank you Michael for all the assistance.

Cheers!

# example configuration for a dialup connection authenticated with PAP or CHAP
#
# This is the default configuration used by pon(1) and poff(1).
# See the manual page pppd(8) for information on all the options.

# MUST CHANGE: replace myusername@realm with the PPP login name given to
# your by your provider.
# There should be a matching entry with the password in /etc/ppp/pap-secrets
# and/or /etc/ppp/chap-secrets.
user "myusername@realm"

# MUST CHANGE: replace ******** with the phone number of your provider.
# The /etc/chatscripts/pap chat script may be modified to change the
# modem initialization string.
#connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T ********"

#connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super'
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T telstra.internet'
# Serial device to which the modem is connected.
#/dev/modem
/dev/ttyUSB2
#/dev/ttyAMA0

# Speed of the serial line.
115200
#9600

nocrtscts
debug
nodetach
ipcp-accept-local
ipcp-accept-remote


# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute

# Makes pppd "dial again" when the connection is lost.
persist

# Do not ask the remote to authenticate.
noauth

# Extral info from https://www.twilio.com/docs/iot/supersim/getting-started-sup>

#nocrtscts
#debug
#nodetach
#ipcp-accept-local
#ipcp-accept-remote
1 Like

Thank you for coming back to close this loop @Kym252504
As troubleshooting, comms, and especially wireless goes - It was always going to be something that feels kinda dumb :confused:

I’m glad your project is on track :partying_face:

I’ll include your writeup in this other thread that shows how you arrived at this conclusion:


PS. I edited your post a bit to format the code with a code block so it should be a bit easier on the eyes.