Skip to content

Commit

Permalink
mesh sample works on 52840dk
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
  • Loading branch information
jori-nordic committed Jul 22, 2024
1 parent dcfc3e7 commit bfb3e30
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 8 deletions.
41 changes: 36 additions & 5 deletions samples/bluetooth/beacon/boards/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
/*
* Copyright 2022 Dronetag
*
* SPDX-License-Identifier: Apache-2.0
*/


&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
<NRF_PSEL(SPIM_MOSI, 0, 29)>,
<NRF_PSEL(SPIM_MISO, 0, 30)>;
};
};
};

/ {
chosen {
zephyr,bt-hci = &hci_spi;
};
};

&spi1 {
status = "okay";

pinctrl-0 = <&spi1_alt>;
pinctrl-names = "default";
/delete-property/ pinctrl-1;
cs-gpios = < &gpio0 31 GPIO_ACTIVE_LOW >;

hci_spi: bt-hci@0 {
compatible = "zephyr,bt-hci-spi";
reg = <0>;
reset-gpios = <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
irq-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
spi-max-frequency = <2000000>;
reset-assert-duration-ms = <6>;
};
};

/{
coex_gpio: coex {
compatible = "gpio-radio-coex";
Expand Down
37 changes: 37 additions & 0 deletions samples/bluetooth/beacon/boards/nrf52dk_nrf52832.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


/delete-node/ &radio;

&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
<NRF_PSEL(SPIM_MOSI, 0, 29)>,
<NRF_PSEL(SPIM_MISO, 0, 30)>;
};
};
};

/ {
chosen {
zephyr,bt-hci = &hci_spi;
};
};

&spi1 {
status = "okay";

pinctrl-0 = <&spi1_alt>;
pinctrl-names = "default";
/delete-property/ pinctrl-1;
cs-gpios = < &gpio0 31 GPIO_ACTIVE_LOW >;

hci_spi: bt-hci@0 {
compatible = "zephyr,bt-hci-spi";
reg = <0>;
reset-gpios = <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
irq-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
spi-max-frequency = <2000000>;
reset-assert-duration-ms = <6>;
};
};
4 changes: 4 additions & 0 deletions samples/bluetooth/beacon/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_DEVICE_NAME="Test beacon"

CONFIG_BT_HCI=y
CONFIG_BT_CTLR=n
CONFIG_BT_SPI=y
34 changes: 34 additions & 0 deletions samples/bluetooth/hci_spi/boards/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/



&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 0, 28)>,
<NRF_PSEL(SPIS_MOSI, 0, 29)>,
<NRF_PSEL(SPIS_MISO, 0, 30)>,
<NRF_PSEL(SPIS_CSN, 0, 31)>;
};
};
};

&spi1 {
compatible = "nordic,nrf-spis";
status = "okay";
def-char = <0x00>;
pinctrl-0 = <&spi1_alt>;
/delete-property/ pinctrl-1;
pinctrl-names = "default";

bt-hci@0 {
compatible = "zephyr,bt-hci-spi-slave";
reg = <0>;
irq-gpios = <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
};
};

33 changes: 33 additions & 0 deletions samples/bluetooth/hci_spi/boards/nrf52dk_nrf52832.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/



&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 0, 28)>,
<NRF_PSEL(SPIS_MOSI, 0, 29)>,
<NRF_PSEL(SPIS_MISO, 0, 30)>,
<NRF_PSEL(SPIS_CSN, 0, 31)>;
};
};
};

&spi1 {
compatible = "nordic,nrf-spis";
status = "okay";
def-char = <0x00>;
pinctrl-0 = <&spi1_alt>;
/delete-property/ pinctrl-1;
pinctrl-names = "default";

bt-hci@0 {
compatible = "zephyr,bt-hci-spi-slave";
reg = <0>;
irq-gpios = <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
};
};
4 changes: 4 additions & 0 deletions samples/bluetooth/hci_spi/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ CONFIG_BT_TINYCRYPT_ECC=n
# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
CONFIG_BT_BUF_CMD_TX_COUNT=10

CONFIG_BT_LOG_LEVEL_DBG=y
CONFIG_LOG=y
CONFIG_BT_EXT_ADV=y
10 changes: 7 additions & 3 deletions samples/bluetooth/mesh/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ For other boards, build and flash the application as follows:
Refer to your :ref:`board's documentation <boards>` for alternative
flash instructions if your board doesn't support the ``flash`` target.

To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application
must also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
application may be used. Build this sample with configuration
Additional kconfig options need to be set on the Bluetooth controller
application if it runs on a separate board or SoC core. Build the controller
application (i.e. ``hci_xx`` sample of your choosing) with the
:zephyr_file:`samples/bluetooth/mesh/controller.conf`.

For the :ref:`nrf5340dk_nrf5340` specifically, build and flash the
:ref:`bluetooth-hci-ipc-sample` application with this configuration
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
to enable mesh support.

Expand Down
45 changes: 45 additions & 0 deletions samples/bluetooth/mesh/boards/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
<NRF_PSEL(SPIM_MOSI, 0, 29)>,
<NRF_PSEL(SPIM_MISO, 0, 30)>;
};
};
};

/ {
chosen {
zephyr,bt-hci = &hci_spi;
};
};

&spi1 {
status = "okay";

pinctrl-0 = <&spi1_alt>;
pinctrl-names = "default";
/delete-property/ pinctrl-1;
cs-gpios = < &gpio0 31 GPIO_ACTIVE_LOW >;

hci_spi: bt-hci@0 {
compatible = "zephyr,bt-hci-spi";
reg = <0>;
reset-gpios = <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
irq-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
spi-max-frequency = <2000000>;
reset-assert-duration-ms = <6>;
};
};

/{
coex_gpio: coex {
compatible = "gpio-radio-coex";
grant-gpios = <&gpio1 0 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>;
grant-delay-us = <150>;
};
};

&radio {
coex = <&coex_gpio>;
};
37 changes: 37 additions & 0 deletions samples/bluetooth/mesh/boards/nrf52dk_nrf52832.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


/delete-node/ &radio;

&pinctrl {
spi1_alt: spi1_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
<NRF_PSEL(SPIM_MOSI, 0, 29)>,
<NRF_PSEL(SPIM_MISO, 0, 30)>;
};
};
};

/ {
chosen {
zephyr,bt-hci = &hci_spi;
};
};

&spi1 {
status = "okay";

pinctrl-0 = <&spi1_alt>;
pinctrl-names = "default";
/delete-property/ pinctrl-1;
cs-gpios = < &gpio0 31 GPIO_ACTIVE_LOW >;

hci_spi: bt-hci@0 {
compatible = "zephyr,bt-hci-spi";
reg = <0>;
reset-gpios = <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
irq-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
spi-max-frequency = <2000000>;
reset-assert-duration-ms = <6>;
};
};
19 changes: 19 additions & 0 deletions samples/bluetooth/mesh/controller.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
CONFIG_BT_BUF_CMD_TX_COUNT=10

# Controller
CONFIG_BT_LL_SW_SPLIT=y

# Disable unused Bluetooth features
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_PRIVACY=n

CONFIG_BT_OBSERVER=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_EXT_ADV=y
4 changes: 4 additions & 0 deletions samples/bluetooth/mesh/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ CONFIG_BT_MESH_SUBNET_COUNT=2
CONFIG_BT_MESH_APP_KEY_COUNT=2
CONFIG_BT_MESH_MODEL_GROUP_COUNT=2
CONFIG_BT_MESH_LABEL_COUNT=3

CONFIG_BT_HCI=y
CONFIG_BT_CTLR=n
CONFIG_BT_SPI=y

0 comments on commit bfb3e30

Please sign in to comment.