Golioth Pouch Gateway is a device capable of connecting to Golioth cloud and serving as proxy for Bluetooth-only devices (nodes). All communication between Bluetooth nodes and cloud is end-to-end encrypted and authenticated. This means that gateway serves as untrusted two-way channel between Bluetooth devices and Golioth cloud.
This application should work on any board with support in Zephyr or nRF Connect SDK that has Bluetooth and Internet capability, though some custom configuration is likely required. The easiest way to get started is to use one of the following targets that are already configured for this application:
- NXP FRDM-RW612
- Nordic Thingy:91 X
- Nordic nRF9160DK
- Sentrius MG100 Gateway
Pre-built firmware binaries for the above hardware are available in GitHub. We recommend using these binaries as the fastest way to get started.
Flashing the FRDM-RW612
-
Install JLink Commander.
-
Program the FRDM-RW612 Gateway Firmware.
a. Connect to the device with JLink Commander
<JLink Commander Executable> -device rw612 -if swd -speed 4000 -autoconnect 1where
<JLink Commander Executable>isJLink.exeon Windows andJLinkExeon Linux and MacOS.b. Issue the following commands in JLink Commander
If using Ethernet:
loadfile frdm_rw612-ethernet.hex reset exitIf using WiFi:
loadfile frdm_rw612-wifi.hex reset exit -
(WiFi Only) Store WiFi AP credentials
a. Open a serial connection to the rw612
b. Store your credentials
wifi cred add -s <your-wifi-ssid> -p <your-wifi-password> -k 1 wifi cred auto_connect
Flashing the Thingy:91 X
-
Install the
nrfutilCLI tool. -
Program the nRF9151 Serial Modem Firmware
a. Position the SWD selection switch (
SW2) tonRF91b. Issue the following command:
nrfutil device program --firmware thingy91x_nrf9151.hex --x-family nrf91 -
Program the nRF5340 Gateway Firmware
a. Power cycle the device and position the SWD selection switch (
SW2) tonRF53b. Issue the following command:
nrfutil device program --firmware thingy91x_nrf5340.hex --x-family nrf53 --core application
Flashing the nRF9160DK
-
Install the
nrfutilCLI tool. -
Program the nRF9160 Serial Modem Firmware
a. Position the SWD selection switch (
SW10) tonRF91b. Issue the following command:
nrfutil device program --firmware nrf9160dk_nrf9160.hex --x-family nrf91 -
Program the nRF52840 Gateway Firmware
a. Power cycle the device and position the SWD selection switch (
SW10) tonRF52b. Issue the following command:
nrfutil device program --firmware nrf9160dk_nrf52840.hex --x-family nrf52
Flashing the MG100
-
Install the
nrfutilCLI tool. -
Program the nRF52840 Gateway Firmware
a. Connect the Tag-Connect adapter and Segger debugger to J5 on the PCBA
b. Issue the following command:
nrfutil device program --firmware mg100.hex --x-family nrf52c. Power cycle the device
To use the Gateway, it needs to be provisioned with credentials for Golioth. For demonstration purposes, the Gateway firmware uses Pre-Shared Keys (PSK). In production settings, Golioth recommends using certificates issued from customer owned Public Key Infrastructure (PKI).
- Create a Device in your Golioth Project.
- Connect to your Gateway over serial and issue the following commands:
settings set golioth/psk-id <psk-id>
settings set golioth/psk <psk>
where <psk-id> and <psk> are the device credentials you created in step 1.
Setup repo with NCS:
west init -m https://github.com/golioth/pouch-gateway.git --mf west-ncs.yml
west update
west patch apply
Serial modem firmware runs on the nRF9151 chip, providing LTE
connectivity to the gateway over UART. Switch to serial modem manifest,
build and flash by changing the SWD switch (SW2) to nRF91, then:
west config manifest.file ncs-serial-modem/west.yml
west update
west patch apply
west build -p -b thingy91x/nrf9151/ns pouch-gateway/ncs-serial-modem/
west flash
Gateway firmware runs on the nRF5340 chip. It runs the Bluetooth Host
stack and communicates with the nRF9151 serial modem over UART for
Internet access. Switch back to NCS manifest, build and flash by
changing the SWD switch (SW2) to nRF53, then:
west config manifest.file west-ncs.yml
west update
west patch apply
west build -p -b thingy91x/nrf5340/cpuapp --sysbuild pouch-gateway/gateway/
west flash
Serial modem firmware runs on the nRF9160 chip, providing LTE
connectivity to the gateway over UART. Switch to serial modem manifest,
build and flash by changing the SWD switch (SW10) to nRF91, then:
west config manifest.file ncs-serial-modem/west.yml
west update
west patch apply
west build -p -b nrf9160dk/nrf9160/ns pouch-gateway/ncs-serial-modem/
west flash
Gateway firmware runs on the nRF52840 chip. It runs the Bluetooth Host
stack and communicates with the nRF9160 serial modem over UART for
Internet access. Switch back to NCS manifest, build and flash by
changing the SWD switch (SW10) to nRF52, then:
west config manifest.file west-ncs.yml
west update
west patch apply
west build -p -b nrf9160dk/nrf52840 --sysbuild pouch-gateway/gateway/
west flash
Setup repo with Zephyr:
west init -m https://github.com/golioth/pouch-gateway.git --mf west-zephyr.yml
west update
west zephyr-export
pip install -r zephyr/scripts/requirements.txt
Gateway firmware runs on nRF52840 chip. There is direct access to LTE modem and also Bluetooth Host stack. Build and flash it with:
west build -p -b mg100 pouch-gateway/gateway --sysbuild
west flash
See Running Pouch Gateway with simulator.
It is possible to disable communication with cloud, so that only
Bluetooth part is tested. In context of nrf52_bsim this allows to run
without BabbleSim handbrake, which normally slows down simulation to
respect communication timeouts enforced in SDK. In case of cellular
connected platforms (nRF91) there is no latency because of cellular
network infrastructure.
CONFIG_POUCH_GATEWAY_CLOUD is available both on the gateway applicaton level
(pouch-gateway/gateway) as well as in sysbuild (mainly for ease of
use) as SB_CONFIG_POUCH_GATEWAY_CLOUD.
Running nrf52_bsim simulaton without cloud communication can be done
with:
west build -p -b nrf52_bsim pouch-gateway/gateway --sysbuild -- \
-DSB_CONFIG_POUCH_GATEWAY_CLOUD=n
west flash