Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/zephyr/gateway/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ config SAMPLE_POUCH_GATEWAY_BT_AUTO_BOND
bool
default y if BOARD_NRF52_BSIM_NATIVE
default y if BOARD_NRF9160DK_NRF52840
default y if BOARD_THINGY91X_NRF5340_CPUAPP_NS

# This option is used only for automated tests
config SAMPLE_POUCH_GATEWAY_BT_AUTO_CONFIRM
bool
default y if BOARD_NRF52_BSIM_NATIVE
default y if BOARD_NRF9160DK_NRF52840
default y if BOARD_THINGY91X_NRF5340_CPUAPP_NS

config EXAMPLE_COAP_CLIENT_SYNC_PERIOD_S
int "CoAP client sync period (s)"
Expand Down
78 changes: 78 additions & 0 deletions examples/zephyr/gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,84 @@ mcumgr --conntype serial --connstring $SERIAL_PORT fs upload $KEY_FILE /lfs1/cre
where `$SERIAL_PORT` is the serial port for the device, like `/dev/ttyACM0` on
Linux, or `COM1` on Windows.

### Provisioning with littlefs binary

Credentials can also be provisioned by creating a LittleFS binary image
containing the certificate and key files, then flashing it directly to the
storage partition on the device.

This approach is useful when MCUmgr USB/serial provisioning is not available,
such as on platforms where the UART is used for other purposes (e.g. serial
modem communication on a Thingy91x-based gateway).

Install the `littlefs_tools` Python package:

```bash
pip install littlefs_tools
```

Create a directory structure for the credentials:

```bash
mkdir -p littlefs/credentials
```

Place your DER-encoded certificate and private key files into the
`littlefs/credentials/` directory:

```
littlefs/
└── credentials
├── crt.der
└── key.der
```

Generate the LittleFS binary image:

```bash
littlefs create -s littlefs -i image.bin -b 4096 -c 8
```

Convert the binary to Intel HEX format at the appropriate flash offset for the
target platform:

```bash
arm-zephyr-eabi-objcopy -I binary -O ihex --change-addresses <storage-partition-address> image.bin lfs_storage.hex
```

The `<storage-partition-address>` is the flash address of the `storage_partition`
in the device tree. See the platform-specific examples below.

Flash the HEX file to the device:

```bash
nrfutil device program \
--firmware lfs_storage.hex \
--core application \
--options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE,reset=RESET_SYSTEM,verify=VERIFY_READ
```

#### Thingy:91 X

For the Thingy:91 X, the nRF5340 application core has the storage partition
at address `0xF8000`. Use `arm-zephyr-eabi-objcopy` from the Zephyr SDK to
convert the binary:

```bash
/path/to/zephyr-sdk-0.17.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-objcopy \
-I binary -O ihex --change-addresses 0xF8000 image.bin lfs_storage.hex
```

Ensure the SWD switch (`SW2`) is set to `nRF53`, then flash to the nRF5340
application core:

```bash
nrfutil device program \
--firmware lfs_storage.hex \
--core application \
--options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE,reset=RESET_SYSTEM,verify=VERIFY_READ
```

## WiFi Gateway Using the NXP frdm_rw612

By default the frdm_rw612 will build with Ethernet support, but may
Expand Down
5 changes: 4 additions & 1 deletion examples/zephyr/gateway/boards/thingy91x_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Reduce max connected BT devices help with RAM usage
CONFIG_BT_MAX_CONN=8

# PPP networking over Serial Modem
CONFIG_NET_L2_PPP=y
CONFIG_NET_L2_PPP_OPTION_DNS_USE=y
Expand All @@ -15,7 +18,7 @@ CONFIG_MODEM_CELLULAR=y
# MTU must accommodate PPP frames (up to 1500 bytes for IP packets)
CONFIG_MODEM_CMUX_MTU=1500
CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA=1024
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA=2048

# UART configuration for nRF5340
CONFIG_UART_INTERRUPT_DRIVEN=y
Expand Down
2 changes: 2 additions & 0 deletions examples/zephyr/gateway_custom_connect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ config SAMPLE_POUCH_GATEWAY_BT_AUTO_BOND
bool
default y if BOARD_NRF52_BSIM_NATIVE
default y if BOARD_NRF9160DK_NRF52840
default y if BOARD_THINGY91X_NRF5340_CPUAPP_NS

# This option is used only for automated tests
config SAMPLE_POUCH_GATEWAY_BT_AUTO_CONFIRM
bool
default y if BOARD_NRF52_BSIM_NATIVE
default y if BOARD_NRF9160DK_NRF52840
default y if BOARD_THINGY91X_NRF5340_CPUAPP_NS

config EXAMPLE_COAP_CLIENT_SYNC_PERIOD_S
int "CoAP client sync period (s)"
Expand Down
78 changes: 78 additions & 0 deletions examples/zephyr/gateway_custom_connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,84 @@ mcumgr --conntype serial --connstring $SERIAL_PORT fs upload $KEY_FILE /lfs1/cre
where `$SERIAL_PORT` is the serial port for the device, like `/dev/ttyACM0` on
Linux, or `COM1` on Windows.

### Provisioning with littlefs binary

Credentials can also be provisioned by creating a LittleFS binary image
containing the certificate and key files, then flashing it directly to the
storage partition on the device.

This approach is useful when MCUmgr USB/serial provisioning is not available,
such as on platforms where the UART is used for other purposes (e.g. serial
modem communication on a Thingy91x-based gateway).

Install the `littlefs_tools` Python package:

```bash
pip install littlefs_tools
```

Create a directory structure for the credentials:

```bash
mkdir -p littlefs/credentials
```

Place your DER-encoded certificate and private key files into the
`littlefs/credentials/` directory:

```
littlefs/
└── credentials
├── crt.der
└── key.der
```

Generate the LittleFS binary image:

```bash
littlefs create -s littlefs -i image.bin -b 4096 -c 8
```

Convert the binary to Intel HEX format at the appropriate flash offset for the
target platform:

```bash
arm-zephyr-eabi-objcopy -I binary -O ihex --change-addresses <storage-partition-address> image.bin lfs_storage.hex
```

The `<storage-partition-address>` is the flash address of the `storage_partition`
in the device tree. See the platform-specific examples below.

Flash the HEX file to the device:

```bash
nrfutil device program \
--firmware lfs_storage.hex \
--core application \
--options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE,reset=RESET_SYSTEM,verify=VERIFY_READ
```

#### Thingy:91 X

For the Thingy:91 X, the nRF5340 application core has the storage partition
at address `0xF8000`. Use `arm-zephyr-eabi-objcopy` from the Zephyr SDK to
convert the binary:

```bash
/path/to/zephyr-sdk-0.17.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-objcopy \
-I binary -O ihex --change-addresses 0xF8000 image.bin lfs_storage.hex
```

Ensure the SWD switch (`SW2`) is set to `nRF53`, then flash to the nRF5340
application core:

```bash
nrfutil device program \
--firmware lfs_storage.hex \
--core application \
--options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE,reset=RESET_SYSTEM,verify=VERIFY_READ
```

## WiFi Gateway Using the NXP frdm_rw612

By default the frdm_rw612 will build with Ethernet support, but may
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Reduce max connected BT devices help with RAM usage
CONFIG_BT_MAX_CONN=8

# PPP networking over Serial Modem
CONFIG_NET_L2_PPP=y
CONFIG_NET_L2_PPP_OPTION_DNS_USE=y
Expand All @@ -15,7 +18,7 @@ CONFIG_MODEM_CELLULAR=y
# MTU must accommodate PPP frames (up to 1500 bytes for IP packets)
CONFIG_MODEM_CMUX_MTU=1500
CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=6000
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA=1024
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA=2048

# UART configuration for nRF5340
CONFIG_UART_INTERRUPT_DRIVEN=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
*/

/ {
chosen {
zephyr,code-partition = &slot0_partition;
};

aliases {
modem = &modem;
};
Expand All @@ -33,6 +37,20 @@
};
};

/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;

&flash0 {
partitions {
slot0_partition: partition@0 {
compatible = "zephyr,mapped-partition";
label = "image-0";
reg = <0x00000000 0x000f8000>;
};
};
};

&uart0 {
status = "okay";
current-speed = <115200>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Route console and logs to RTT so the nRF9151's two UARTs are free for the
# inter-chip serial-modem link (UART0/UART1 data + flow control pins).
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_UART=n
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_USE_SEGGER_RTT=y
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,28 @@
*/

/ {
rtt0: rtt_chan0 {
compatible = "segger,rtt-uart";
status = "okay";
};

chosen {
ncs,sm-uart = &dtr_uart1;
/*
* Route console/shell to RTT. The nRF9151's UART0 and UART1
* data pins (P0.00/P0.01) are used by the inter-chip
* serial-modem link, so UART0 cannot also drive the console.
*/
zephyr,console = &rtt0;
zephyr,shell-uart = &rtt0;
};
};

/* UART0 is disabled to release P0.00/P0.01 for the modem UART1. */
&uart0 {
status = "disabled";
};

&uart1 {
pinctrl-0 = <&uart_vcom0_vcom1_default>;
pinctrl-1 = <&uart_vcom0_vcom1_sleep>;
Expand Down
Loading