Skip to content

Commit

Permalink
feat(boards): Add support for nRF5340 DK
Browse files Browse the repository at this point in the history
Added overlays to support building for the nRF5340 development kit.

Also added some documentation on how to build and flash ZMK for dual-
chip Bluetooth configurations, with an example for the nRF5340.
  • Loading branch information
joelspadin committed Dec 1, 2022
1 parent 6550c04 commit d5acf4a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/boards/nrf5340dk_nrf5340_cpuapp.conf
@@ -0,0 +1,15 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Default main stack size is too small for HCI RPMsg
CONFIG_MAIN_STACK_SIZE=2048
18 changes: 18 additions & 0 deletions app/boards/nrf5340dk_nrf5340_cpuapp.overlay
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

/ {
chosen {
zephyr,console = &cdc_acm_uart;
};
};

&usbd {
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};
20 changes: 20 additions & 0 deletions docs/docs/development/build-flash.md
Expand Up @@ -140,3 +140,23 @@ your board and run the following command to flash:
```
west flash
```

## Multi-CPU and Dual-Chip Bluetooth Boards

Zephyr supports running the Bluetooth host and controller on separate processors. In such a configuration, ZMK always runs on the host processor, but you may need to build and flash separate firmware for the controller. Zephyr provides sample code which can be used as the controller firmware for Bluetooth HCI over [RPMsg](https://docs.zephyrproject.org/latest/samples/bluetooth/hci_rpmsg/README.html), [SPI](https://docs.zephyrproject.org/latest/samples/bluetooth/hci_spi/README.html), [UART](https://docs.zephyrproject.org/latest/samples/bluetooth/hci_uart/README.html), and [USB](https://docs.zephyrproject.org/latest/samples/bluetooth/hci_usb/README.html). See [Zephyr's Bluetooth Stack Architecture documentation] for more details.

The following documentation shows how to build and flash ZMK for boards that use a dual-chip configuration.

### nRF5340

To build and flash the firmware for the nRF5340 development kit's network core, run the following command from the root of the ZMK repo:

```sh
cd zephyr/samples/bluetooth/hci_rpmsg
west build -b nrf5340dk_nrf5340_cpunet
west flash
```

You can then build and flash ZMK firmware using the normal steps described above. The network core's firmware only needs to be updated whenever ZMK upgrades to a new version of Zephyr.

For a custom nRF5340-based board, you will need to define two Zephyr boards: one for the application core and one for the network core. The [nRF5340 DK's board definition](https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/arm/nrf5340dk_nrf5340) can be used as reference. Replace `nrf5340dk_nrf5340_cpunet` with the name of your network core board.

0 comments on commit d5acf4a

Please sign in to comment.