This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I want to resolve errors at the start of BLE advertising

An error occurs when you run the following program(main.c).

[1;33m<wrn> bt_hci_core: opcode 0x2006 status 0x01
[1;31m<err> LOG_MODULE_NAME: Advertising start (err -5)

What could be the cause?

void main(void)
{
int err;

err = bt_enable(NULL);
if (err) {
LOG_ERR("Bluetooth init failed (err %d)\n", err);
return;
}

LOG_INF("Bluetooth initialized\n");

if (IS_ENABLED(CONFIG_SETTINGS)) {
settings_load();
}

err = bt_le_adv_stop();
if (err) {
LOG_ERR("Advertising stop (err %d)\n", err);
return;
}
err = bt_le_adv_start(ADV_PARAM, ad, ARRAY_SIZE(ad), NULL, 0);
if (err) {
LOG_ERR("Advertising start (err %d)\n", err);
return;
}
}

prj.conf

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
#CONFIG_BT_H4=y
#CONFIG_BT_WAIT_NOP=y
#CONFIG_BT_CENTRAL=y
CONFIG_BT_L2CAP_TX_BUF_COUNT=5
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_DEV"
CONFIG_BT_MAX_CONN=2
CONFIG_BT_MAX_PAIRED=2
CONFIG_BT_SMP=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_PRIVACY=y
CONFIG_BT_SCAN_WITHIDENTITY=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_DM=y

CONFIG_BT_COMM_CTX=y

# Enable the BLE modules from NCS
CONFIG_BT_NUS_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
# CONFIG_BT_SCAN_ADDRESS_CNT=1
CONFIG_BT_GATT_DM=y
CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_BT_OBSERVER=y

# This example requires more workqueue stack
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=y

CONFIG_USE_SEGGER_RTT=y
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y

CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
CONFIG_BT_CTLR=y

#CONFIG_UART_2_NRF_UARTE=y
#CONFIG_UART_2_NRF_FLOW_CONTROL=y
#CONFIG_UART_INTERRUPT_DRIVEN=y

#CONFIG_BSD_LIBRARY_TRACE_ENABLED=n

CONFIG_BT_DEBUG_HCI_DRIVER=y
CONFIG_BT_HCI=y
CONFIG_BT_RPMSG=y

Parents
  • Hi!

    Could you give me some more information about your application?
    - Is it based on some sort of sample?
    - Is it running on the nRF9160 or the nRF52840 of the Thingy:91?
    - If the code is running on the nRF9160, which hci UART sample are you using for the nRF52840?

    From your error it seems like there is an issue with the BT interfacing. I suggest looking at how it's setup in the lte_ble_gateway sample

    PS: The Holiday season is upon us, which will leave the Nordic support team understaffed until January 4th, 2021. This means that delayed replies will occur during this time. Sorry about the inconvenience and happy Holidays!

    Best regards,
    Carl Richard

Reply
  • Hi!

    Could you give me some more information about your application?
    - Is it based on some sort of sample?
    - Is it running on the nRF9160 or the nRF52840 of the Thingy:91?
    - If the code is running on the nRF9160, which hci UART sample are you using for the nRF52840?

    From your error it seems like there is an issue with the BT interfacing. I suggest looking at how it's setup in the lte_ble_gateway sample

    PS: The Holiday season is upon us, which will leave the Nordic support team understaffed until January 4th, 2021. This means that delayed replies will occur during this time. Sorry about the inconvenience and happy Holidays!

    Best regards,
    Carl Richard

Children
Related