Hi,
I am trying to receive messages via Bluetooth mesh and forward them via UART (using UART async API) on the nrf9160DK. But when I try this, I get an assertion error from the HCI core indicating a timeout (see logs). Below you can see my configs and source code.
Does anyone see if I have made a mistake somewhere?
Thank you in advance and happy new year tomorrow!
Information:
- Device: nrf9160dk_nrf52840
- DK version: 1.0.0
- NCS version: v1.8.0
Log:
[00:00:00.000,183] <inf> board_control: vcom0_pins_routing is ENABLED
[00:00:00.006,988] <inf> board_control: vcom2_pins_routing is ENABLED
[00:00:00.013,885] <inf> board_control: led1_pin_routing is ENABLED
[00:00:00.020,568] <inf> board_control: led2_pin_routing is ENABLED
[00:00:00.027,282] <inf> board_control: led3_pin_routing is ENABLED
[00:00:00.033,996] <inf> board_control: led4_pin_routing is ENABLED
[00:00:00.040,679] <inf> board_control: switch1_pin_routing is ENABLED
[00:00:00.047,668] <inf> board_control: switch2_pin_routing is ENABLED
[00:00:00.054,626] <inf> board_control: button1_pin_routing is ENABLED
[00:00:00.061,584] <inf> board_control: button2_pin_routing is ENABLED
[00:00:00.068,542] <inf> board_control: nrf_interface_pins_0_2_routing is ENABLED
[00:00:00.076,477] <inf> board_control: nrf_interface_pins_3_5_routing is ENABLED
[00:00:00.084,411] <inf> board_control: nrf_interface_pins_6_8_routing is disabled
[00:00:00.092,407] <inf> board_control: nrf_interface_pin_9_routing is ENABLED
[00:00:00.100,067] <inf> board_control: io_expander_pins_routing is disabled
[00:00:00.107,574] <inf> board_control: external_flash_pins_routing is disabled
[00:00:00.115,325] <inf> board_control: Board configured.
*** Booting Zephyr OS build v2.7.0-ncs1 ***
[00:00:00.125,152] <inf> app: Initializing...
[00:00:00.130,035] <wrn> mesh_uart: UART rx buffer full
[00:00:00.142,303] <inf> fs_nvs: 8 Sectors of 4096 bytes
[00:00:00.148,010] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.153,228] <inf> fs_nvs: data wra: 0, 0
[00:00:00.158,355] <inf> sdc_hci_driver: SoftDevice Controller build revision:
df c0 4e d6 1f 7c 66 09 0a f5 2b a0 98 f2 43 64 |..N..|f. ..+...Cd
62 c5 a6 2a |b..*
ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:306
k_sem_take failed with err -11
[00:00:10.195,648] <err> os: r0/a1: 0x00000003 r1/a2: 0x20000d88 r2/a3: 0x00000000
[00:00:10.204,132] <err> os: r3/a4: 0x2000a3de r12/ip: 0x00000000 r14/lr: 0x0001f601
[00:00:10.212,615] <err> os: xpsr: 0x61000000
[00:00:10.217,712] <err> os: Faulting instruction address (r15/pc): 0x0001f60c
[00:00:10.225,433] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
[00:00:10.232,879] <err> os: Current thread: 0x20002fe0 (sysworkq)
prj.conf:
# General configuration
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_HWINFO=y
CONFIG_DK_LIBRARY=y
CONFIG_ASSERT=y
# Bluetooth configuration
CONFIG_BT=y
CONFIG_BT_COMPANY_ID=0x0059
CONFIG_BT_DEVICE_NAME="Mesh Sensor Client"
CONFIG_BT_L2CAP_TX_MTU=69
CONFIG_BT_L2CAP_TX_BUF_COUNT=32
CONFIG_BT_OBSERVER=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SETTINGS=y
# Disable unused Bluetooth features
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_PRIVACY=n
# Bluetooth mesh configuration
CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_MESH_FRIEND=y
CONFIG_BT_MESH_ADV_BUF_COUNT=64
CONFIG_BT_MESH_TX_SEG_MAX=32
CONFIG_BT_MESH_RX_SEG_MAX=16
CONFIG_BT_MESH_PB_GATT=y
CONFIG_BT_MESH_GATT_PROXY=y
CONFIG_BT_MESH_DK_PROV=y
# Bluetooth mesh models
CONFIG_BT_MESH_SENSOR_CLI=y
# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_UART_ASYNC_API=y
nrf9160dk_nrf52840.conf:
CONFIG_UART_1_ASYNC=y
CONFIG_UART_1_INTERRUPT_DRIVEN=n
CONFIG_UART_1_NRF_HW_ASYNC=y
CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2
CONFIG_GPIO=y
nrf9160dk_nrf52840.overlay:
#include <nrf9160dk_nrf52840_reset_on_if5.dtsi>
#include <nrf9160dk_uart1_on_if0_3.dtsi>
/ {
aliases {
uart =&uart1;
};
};
&uart1 {
compatible = "nordic,nrf-uarte";
current-speed = <1000000>;
hw-flow-control;
status = "okay";
tx-pin = <17>;
rx-pin = <20>;
rts-pin = <15>; /* <&interface_to_nrf9160 2 0>; */
cts-pin = <22>; /* <&interface_to_nrf9160 3 0>; */
};
nrf9160dk_nrf52840_0_14_0.overlay:
/* SPDX-License-Identifier: Apache-2.0 */
/* Use the reset line that is available starting from v0.14.0 of the DK. */
#include <nrf9160dk_nrf52840_reset_on_if9.dtsi>
main.c
...
static void bt_ready(int err)
{
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
printk("Bluetooth initialized\n");
err = bt_mesh_init(bt_mesh_dk_prov_init(), model_handler_init());
if (err) {
printk("Initializing mesh failed (err %d)\n", err);
return;
}
if (IS_ENABLED(CONFIG_SETTINGS)) {
settings_load();
}
/* This will be a no-op if settings_load() loaded provisioning info */
bt_mesh_prov_enable(BT_MESH_PROV_ADV | BT_MESH_PROV_GATT);
printk("Mesh initialized\n");
}
void main(void)
{
int err;
LOG_INF("Initializing...\n");
dk_leds_init();
dk_buttons_init(NULL);
mesh_uart_init(mesh_evt_handler);
err = bt_enable(bt_ready);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
}
}