Why this tutorial? Raspberry PI 3 brings new on the shelf functionalities like Bluetooth and wireless LAN, but comes with some issues related to the backwards compatibility. The integration of the new BCM2837 SOC- ARM Cortex-A53 CPU(ARM v8), 1.2GHz 64-bit quad-core- along side with the BCM43438 (combo 802.11n W-LAN and Bluetooth 4.1) chip generates following two problems:
- a. /dev/ttyAMA0 serial port was moved from GPIO 14&15, in order to support the Bluetooth connectivity and,
- b. Debian Wheezy (mainly used) distribution has not ARM v8 support ready. Raspbian Jessie distribution supported it and, at this time it, is the single Raspbian officially supported by raspberrypi.org.
This tutorial guide you how to deal with RASPBIAN JESSIE and Raspberry PI3 serial communication with 3G or GSM modem. Applies also to Raspberry PI2 / B+ / ZERO used in conjunction with Jessie distribution.
Whats to do (what are the targets):
- - Free and allocate back to GPIO14/15 pins (as in previous version of RPi) the /dev/ttyAMA0 serial port (make it available for GSM/3G modem usage)
- - OPTIONAL - Allocate the /dev/ttyS0 mini UART(serial) port to the BLUETOOTH service (Raspberry PI 3 only). Some limitation may apply in the Bluetooth functionality! Google for "Raspberry PI 3 miniUART specifications"
Time needed: between 30 minutes up to 120 minutes, if you start from scratch.
Previous skills required: install/configure Linux/Raspbian, entry/medium level.
Hardware platform used for testing: Raspberry PI3, Raspberry PI2, itbrainpower.net c-uGSM and d-u3G pin2 pin compatible shields.
Step 1: C-uGSM / D-u3G Shields USB Connectivity Still Available on the Shelf
c-uGSM and d-u3G shields via USB connection it is supported by Raspbian Jessie distribution out of the shelf. You can check it at shield USB connection time:
- a. Run "tail -f /var/log/messages"
- b. Connect the USB cable (for d-u3G you must power up the modem also)
Observe the following message:
"usb 1-1.2: cp210x converter now attached to ttyUSB0" for c-uGSM (connection via /dev/ttyUSB0) or,
"cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device" for d-u3G (connection via /dev/ttyACM0)
Hint: for c-uGSM connection via USB, RX and TX must be leaved not connected.
But sometimes, you may need to use the SERIAL connectivity. See how in next step.
Step 2: Configure Raspberry PI 3 / JESSIE for GSM/ 3G Serial Modem Usage
Prepare your coffee or tea and let's do the job!
Step 1: Download the Raspbian Jessy image from Raspberry Foundation downloads section.
Step 2: Install the Raspbian Jessy image to you SD card. See: how to install Raspian distribution images on SD card. SDFORMATER and WIN32DISKIMAGER utilities can help you ...google for.
Step 3: Boot the RPi 3 or whatever from the SD card with the OS image installed
Step 4: Open a shell and run "sudo apt-get update" (I suppose you already connect your RPi to your LAN ;) )
Step 5: Run "sudo apt-get install mc" (optional)
Step 6: Run "sudo raspi-config" and:
- - disable SERIAL console
- - enable your RPi to boot to runlevel3 / shell with or without password
- - enable SSHD (optional)
- - Save/reboot if needed.
Step 7: Edit /boot/config.txt (Eg.: "sudo mcedit /boot/config.txt" or "sudo nano /boot/config.txt"), and add at the end of the file following two options:
- - "dtoverlay=pi3-disable-bt" (disable Bluetooth and remap ttyAMA0 back to GPIO 14&15...YES!!!!)
- - "dtoverlay=pi3-miniuart-bt" (map miniUART to the Bluetooth chip) - OPTIONAL
Step 8: Run "sudo systemctl disable hciuart" (disable the Bluetooth service)
Step 9: Edit /lib/systemd/system/hciuart.service (OPTIONAL), and:
- - replace "/dev/ttyAMA0" with "/dev/ttyS0" (setup the Bluetooth service to use miniUART)
- - adjust the connection speed (the miniUART port supports up to 115200)
- - don't forget to save.
Step 10: Run "sudo systemctl enable hciuart" (enable the Bluetooth service) -OPTIONAL
Step 11: Reboot the RPi ("sudo init6" or "sudo shutdown -r").
The SERIAL port ("/dev/ttyAMA0") configuration is DONE. For hardware connection, follow the references in the next step.
Step 3: Raspbian Jessie, Raspberry PI 3 / 2 / ZERO and GSM / 3G Serial Modem Usage Additional Hints
For easiest hardware interfacing, we recommend to you our new i-hatGSM3G v1.01 by itbrainpower.net adapter board (connects your RPi x, B type to your c-uGSM/d-u3G shield without wires), as seen on image up here (here d-u3G shield -3G version- it is used, but same connection apply for c-uGSM shield -GSM only version). Else, you may still connect the boards, using wires in the old fashion way. Use as wiring reference:
Download and use the latest version of c-uGSM shield Python demo/support files or d-u3G shield Python demo/support files. The software supports SERIAL and USB connectivity and it is compatible with latest Raspbian Jessy and previous Raspbian Weezy. With some updates (mainly on port names), you can use it with any Linux distribution running on top of BeagleBone, Banana Pi, or any other Raspberry like ARM board.
TUTORIAL PROVIDED WITHOUT ANY WARRANTY!!! USE IT AT YOUR OWN RISK!!!!
All itbrainpower.net products can be ordered online via itbrainpower.net distributors.
Originally published by me, in 2016, on itbrainpower.net projects and how to section.