First you will need to do a little setup specific to your development board. Follow the steps below that are for your specific board. Note: You will need to have your board connected to the internet for the following steps so software and configuration can be downloaded.

Raspberry Pi

On the Raspberry Pi you will need to disable the kernel's use of the hardware serial connection. By default when the Raspberry Pi boots it will use the serial connection to print messages from the kernel which will confuse FONA. However it's easy to disable this serial usage by running Andrew Scheller's handy serial console script. Connect to your Raspberry Pi's command terminal and execute:
sudo wget -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console
sudo rpi-serial-console disable
Once the commands above are run, reboot your Raspberry Pi and connect again to the command terminal.

For reference, when you're done using FONA and wish to enable the kernel serial console again you can run the script with:
sudo rpi-serial-console enable

BeagleBone Black

On the BeagleBone Black you'll need to enable a serial UART in the device tree. By default the BeagleBone Black uses its serial UART ports for GPIO and other uses. However by loading a device tree overlay you can enable a serial UART.

The BeagleBone Black supports up to 4 serial UARTs. In this guide I found it's easiest to use UART4 and will describe its usage below.

The best way to enable UART4 is to modify the uEnv.txt file so the UART4 device tree overlay is loaded automatically at boot. With the BeagleBone Black connected to your computer through its USB mini connection, open the 'boot' USB storage device. Edit the file uEnv.txt on this device and add the following line at the bottom on a new line:


NOTE: Don't edit uEnv.txt from a Windows machine as it can change line endings and cause the BeagleBone Black to require an operating system reinstall! Instead connect to the BeagleBone Black's command terminal and edit uEnv.txt by following the steps at the end of the exporting an overlay guide page.

Once uEnv.txt has been updated, reboot your BeagleBone Black and verify you can see a /dev/ttyO4 (that's an upper case O, not a zero) device.

Software Setup

On both the Raspberry Pi and BeagleBone Black perform the steps below to install and setup the PPP software.

First make sure software is installed by executing the following in a command terminal:
sudo apt-get update
sudo apt-get install ppp screen elinks
You can ignore any warnings about software already being installed.

Once the commands above are executed you can test communication with FONA. The screen tool will be used to open the serial connection to FONA and verify FONA responds to commands. Make sure FONA is wired to your device and turned on (the blue LED is solidly lit and the red LED periodically flashes). Then on a Raspberry Pi execute:
screen /dev/ttyAMA0 115200
Or on a BeagleBone Black execute:
screen /dev/ttyO4 115200
Screen will open the serial port and should show a blank screen. If you see a connection error double check FONA is wired correctly to your board and turned on, then try again.

Now type AT and press enter (you might not see the AT characters echoed back as you type, don't worry that's ok). You should see FONA respond with OK. If you see the OK response then communication with FONA is working great and you can close screen. To close screen press Ctrl-A and type :quit and press enter.

If you did not see the OK response, double check FONA is wired correctly to your serial port and is turned on (solid blue LED lit, periodic red flash), then try again. Don't move on until you've confirmed you can connect to FONA and get a response from it!

PPP Configuration

Next you can configure PPP by following the steps below to create a new PPP peer configuration. The steps below were adapted from Ubuntu's ADSL PPPoE guide manual configuration by hand section.

In a command terminal execute the following commands to login as root and navigate to the /etc/ppp/peers/ directory:
sudo -i
cd /etc/ppp/peers/
Inside the peers directory there are configuration files which define how each PPP connection is setup. Download an example FONA configuration file called fona by executing:
Now open the file fona in a text editor by executing:
nano fona
You should see a file that looks like the following:
# Example PPPD configuration for FONA GPRS connection on Debian/Ubuntu.

# MUST CHANGE: Change the -T parameter value **** to your network's APN value.
# For example if your APN is 'internet' (without quotes), the line would look like:
# connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T internet"
connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T ****"

# MUST CHANGE: Uncomment the appropriate serial device for your platform below.
# For Raspberry Pi use /dev/ttyAMA0 by uncommenting the line below:
# For BeagleBone Black use /dev/ttyO4 by uncommenting the line below:

# Speed of the serial line.

# Assumes that your IP address is allocated dynamically by the ISP.

# Try to get the name server addresses from the ISP.

# Use this connection as the default route to the internet.

# Makes PPPD "dial again" when the connection is lost.

# Do not ask the remote to authenticate.

# No hardware flow control on the serial link with FONA

# No modem control lines with FONA.
This configuration file controls the options that will be set by PPPD when the FONA PPP connection is created. You can find a description of all the options in the PPPD man page if you're curious.

Notice the two sections at the top that say MUST CHANGE. The first section controls which script is called by PPPD to tell FONA to set up a GPRS connection. This section uses the chat command to send and expect certain strings when communicating with FONA.

The only thing you must change is the APN value on the connect line. You need to change the -T **** option at the end to be -T APN_value. For example if your APN is "internet" (without quotes), you would change the line to read:

connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T internet"
The second thing you must change is the configuration of the serial port connected to FONA. Uncomment (remove the preceding #) the /dev/ttyAMA0 line if you're using a Raspberry Pi, or uncomment the /dev/ttyO4 line if you're using a BeagleBone Black.

The rest of the settings in the file do not need to be modified. Save the file (press Ctrl-O then enter in nano), then quit the editor (press Ctrl-X in nano).

You might have noticed that the connect line in the PPP peers configuration references a specific chat script. To see this configuration open the /etc/chatscripts/gprs file in a text editor to see what it contains. For example execute:
nano /etc/chatscripts/gprs
You should see a file like the following:
# You can use this script unmodified to connect to cellular networks.
# The APN is specified in the peers file as the argument of the -T command
# line option of chat(8).

# For details about the AT commands involved please consult the relevant
# standard: 3GPP TS 27.007 - AT command set for User Equipment (UE).
# (

ABORT           BUSY
ABORT           VOICE
ABORT           "NO CARRIER"
ABORT           "NO DIAL TONE"
ABORT           "NO ANSWER"
ABORT           "DELAYED"
ABORT           "ERROR"

# cease if the modem is not attached to the network yet
ABORT           "+CGATT: 0"

""              AT
TIMEOUT         12
OK              ATH
OK              ATE1

# +CPIN provides the SIM card PIN
#OK             "AT+CPIN=1234"

# +CFUN may allow to configure the handset to limit operations to
# GPRS/EDGE/UMTS/etc to save power, but the arguments are not standard
# except for 1 which means "full functionality".
#OK             AT+CFUN=1

OK              AT+CGDCONT=1,"IP","\T","",0,0
OK              ATD*99#
TIMEOUT         22
CONNECT         ""
You probably don't need to modify this file, but it's good to be aware of its contents in case you need to customize how the GPRS connection is created. The format of the file is described in the chat man page, but in general the structure is text to send on the serial connection, followed by whitespace, and then a result to expect to receive on the serial connection.

One thing to note is the commented line '+CPIN provides the SIM card PIN'. If your SIM card requires a PIN to unlock, uncomment this line and set the PIN value.

Save the file if you've made changes, and exit the text editor. You are now done configuring the PPP connection and can exit the sudo interactive root shell by running:
You should be brought back to a command terminal on your Raspberry Pi or BeagleBone Black as the user you originally connected to the device. You're now ready to test and use the GPRS connection in the next section of the guide.

This guide was first published on Jul 08, 2014. It was last updated on Apr 23, 2024.

This page (Setup) was last updated on Jul 07, 2014.

Text editor powered by tinymce.