Skip to content

Latest commit

 

History

History
129 lines (90 loc) · 3.67 KB

README.rst

File metadata and controls

129 lines (90 loc) · 3.67 KB

Golioth Settings sample

Overview

This sample application demonstrates how to use the Golioth Settings service. Additionally, it shows how to enable Zephyr Settings subsystem and use it for storing Golioth credentials, as well as how to provision these credentials using the device shell CLI.

Requirements

  • Golioth credentials
  • Network connectivity

Building and Running

Platform specific configuration

nRF52840 DK + ESP32-WROOM-32

This subsection documents using nRF52840 DK running Zephyr with offloaded ESP-AT WiFi driver and ESP32-WROOM-32 module based board (such as ESP32 DevkitC rev. 4) running WiFi stack. See AT Binary Lists for links to ESP-AT binaries and details on how to flash ESP-AT image on ESP chip. Flash ESP chip with following command:

esptool.py write_flash --verify 0x0 PATH_TO_ESP_AT/factory/factory_WROOM-32.bin

Connect nRF52840 DK and ESP32-DevKitC V4 (or other ESP32-WROOM-32 based board) using wires:

nRF52840 DK ESP32-WROOM-32
P1.01 (RX) IO17 (TX)
P1.02 (TX) IO16 (RX)
P1.03 (CTS) IO14 (RTS)
P1.04 (RTS) IO15 (CTS)
P1.05 EN
GND GND

On your host computer open a terminal window, locate the source code of this sample application (i.e., samples/settings) and type:

$ west build -b nrf52840dk_nrf52840 samples/settings
$ west flash

Configure PSK-ID and PSK using the device shell based on your Golioth credentials:

uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
uart:~$ settings set golioth/psk <my-psk>

Configure WiFi SSID and PSK using the device shell and reboot:

uart:~$ settings set wifi/ssid <my-ssid>
uart:~$ settings set wifi/psk <my-psk>
uart:~$ kernel reboot cold

nRF9160 DK

On your host computer open a terminal window, locate the directory that contains the sample folder (i.e., ~/zephyr-nrf/modules/lib/golioth). We will build it without assigning any Golioth credentials, and this sample automatically builds for MCUboot. Build and flash examples are below:

$ west build -b nrf9160dk_nrf9160_ns samples/settings
$ west flash

Configure PSK-ID and PSK using the device shell based on your Golioth credentials and reboot:

uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
uart:~$ settings set golioth/psk <my-psk>
uart:~$ kernel reboot cold

ESP32

Configure the following Kconfig options based on your WiFi AP credentials by adding these lines to configuration file (e.g. prj.conf or board/esp32.conf):

CONFIG_GOLIOTH_SAMPLE_WIFI_SSID="my-wifi"
CONFIG_GOLIOTH_SAMPLE_WIFI_PSK="my-psk"

On your host computer open a terminal window, locate the source code of this sample application (i.e., samples/settings) and type:

$ west build -b esp32 samples/settings
$ west flash

Configure PSK-ID and PSK using the device shell based on your Golioth credentials and reboot:

uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
uart:~$ settings set golioth/psk <my-psk>
uart:~$ kernel reboot cold