The SARA-R5 cellular module on the OzzMaker SARA-R5 LTE-M GPS + 10DOF supports the 3GPP TS 27.010 multiplexer protocol. With this protocol , it is possible to emulate several virtual connection channels on a single physical serial interface between a Raspberry Pi and the SARA-R5 module. This allows for the streaming of GNSS data, the action of performing AT commands and having an active 5G connection all at the same time.
When enabling the multiplexer protocol on the Raspberry Pi and SARA-R5 module, you can access 3 UART channels which would be able to perform these functions;
- Channel 0 – AT Commands and Data
- Channel 1 – AT Commands and Data
- Channel 2 – GNSS Streaming
To be able to use this protocol, we will need to install the gsmMuxd driver.
1. Open raspi-config and disable the serial console
The serial console needs to be disabled and then the serial port enabled.
interfacing options -> Serial -> No -> Yes
Yes to reboot
2. Download and compile gsmMuxd
Download and compile the multiplexer driver and copy it to the bin directory. Finally, exit root.
git clone https://github.com/ozzmaker/gsmmux
cp gsmMuxd /usr/bin/gsmMuxd
3. Add Pi user to TTY group
Now add ‘pi’ user to the tty group;
Log out and then back in again for the new group assignment to take effect.
4. Run gsmMuxd
Run gsmMux driver to enable multiplexing;
/dev/ttyGSM0 Command Channel
/dev/ttyGSM1 Command Channel
/dev/ttyGSM2 GNSS Tunneling
pi@raspberrypi ~ $
Above you can see that 3 virtual channels created by the gsmMuxd driver;
- /dev/ttyGSM0 – AT Commands and Data
- /dev/ttyGSM1 – AT Commands and Data
- /dev/ttyGSM2 – GNSS Streaming
When needing to configure the cellular module using AT commands, you can use minicom and you would need to connect to either ttyGSM0 or ttyGSM1.
You can install minicom with;
Then connect to either ttyGSM0 or ttyGSM1.
If using ttyGSM0 to configure the modem, you would then use ttyGSM1 to create a data connection with your provider.
ttyGSM2 would be used to receive GNSS data from the module. You would point GPSD to this interface
Reset SARA-R5 when rebooting
For some Raspberry Pis, when rebooting the Pi, the MUX no longer works. (We are still working out why)
To fix this, we can do a quick reset on booting, as well as load the mux driver.
If you dont have this issue when rebooting, you can skip this step.
We will need to connect the PWR pin on the SARA-R5 module to GPIO4 on the Raspberry Pi, this can be done by placing a solder “blob” on the bottom two pads on Jumper JP1. (pads shown below)
Now create a script which will be used to bounce the PWR pin and load the mux driver
Copy in the text below, then save and exit
#!/bin/bash raspi-gpio set 4 op pn dl sleep 30 raspi-gpio set 4 dh sleep 3 raspi-gpio set 4 op pn dl sleep 3 raspi-gpio set 4 dh sleep 3 gsmMuxd
Make the script executable;
You add the startup script to /etc/rc.local to make it load on boot.
Just before the exit 0 at the bottom, insert this line