I am facing issue with BLE advertisement in nRF52833. The board I am using is rayBeacon: nRF52 on-the-go Development Kit. The code I am using is example code from nRF Academy.
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/bluetooth/gap.h>
#include <zephyr/bluetooth/bluetooth.h>
/* Log Module Registration */
LOG_MODULE_REGISTER(BLE_LOG, LOG_LEVEL_DBG);
/* Sleep Time */
#define SLEEP_TIME_MS 1000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
/* Set Device Name */
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
/* Advertising Packet */
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_NO_BREDR),
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
};
/* URI */
static unsigned char url_data[] = {
0x17, '/', '/', 'w', 'w', 'w', '.', 'u', 's', 't', '.', 'c', 'o', 'm'};
/* Scan Response Packet*/
static const struct bt_data sd[] = {
BT_DATA(BT_DATA_URI, url_data, sizeof(url_data)),
};
int main(void)
{
int err;
if (!gpio_is_ready_dt(&led))
{
return 0;
}
err = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (err < 0)
{
return 0;
}
err = bt_enable(NULL);
if (err)
{
LOG_ERR("Bluetooth init failed (err %d)\n", err);
return 0;
}
LOG_INF("Bluetooth initialized\n");
err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
sd, ARRAY_SIZE(sd));
if (err)
{
LOG_ERR("Advertising failed to start (err %d)\n", err);
return 0;
}
LOG_INF("Advertising successfully started\n");
for (;;)
{
gpio_pin_toggle_dt(&led);
k_sleep(K_MSEC(SLEEP_TIME_MS));
}
}
The error I am facing is nRF52833 is resetting continuously after the advertisement is started. The response in the terminal is
*** Booting nRF Connect SDK[00:00:00.000,305] [1B][0m<inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
c5 93 ba a9 14 4d 8d 05 30 4e 9b 92 d7 71 1e e8 |.....M.. 0N...q..
aa 02 50 3c |..P< [1B][0m
[00:00:00.002,166] [1B][0m<inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)[1B][0m
[00:00:00.002,197] [1B][0m<inf> bt_hci_core: HW Variant: nRF52x (0x0002)[1B][0m
[00:00:00.002,197] [1B][0m<inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017[1B][0m
[00:00:00.002,929] [1B][0m<inf> bt_hci_core: Identity: C2:EF:9A:ED:BB:A1 (random)[1B][0m
[00:00:00.002,960] [1B][0m<inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x1102, manufacturer 0x0059[1B][0m
[00:00:00.002,990] [1B][0m<inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x1102[1B][0m
[00:00:00.002,990] [1B][0m<inf> BLE_LOG: Bluetooth initialized
[1B][0m
[00:00:00.003,967] [1B][0m<inf> BLE_LOG: Advertising successfully started
[1B][0m
[00:00:00.006,256] [1B][1;31m<err> mpsl_init: MPSL ASSERT: 112, 2185[1B][0m
[00:00:00.006,286] [1B][1;31m<err> os: ***** HARD FAULT *****[1B][0m
[00:00:00.006,286] [1B][1;31m<err> os: Fault escalation (see below)[1B][0m
[00:00:00.006,317] [1B][1;31m<err> os: ARCH_EXCEPT with reason 3
[1B][0m
[00:00:00.006,317] [1B][1;31m<err> os: r0/a1: 0x00000003 r1/a2: 0x00000000 r2/a3: 0x00000001[1B][0m
[00:00:00.006,347] [1B][1;31m<err> os: r3/a4: 0x00000000 r12/ip: 0x200009b8 r14/lr: 0x0000af7b[1B][0m
[00:00:00.006,347] [1B][1;31m<err> os: xpsr: 0x41000018[1B][0m
[00:00:00.006,378] [1B][1;31m<err> os: Faulting instruction address (r15/pc): 0x0000f90c[1B][0m
[00:00:00.006,408] [1B][1;31m<err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0[1B][0m
[00:00:00.006,408] [1B][1;31m<err> os: Fault during interrupt handling
[1B][0m
[00:00:00.006,439] [1B][1;31m<err> os: Current thread: 0x20001010 (unknown)[1B][0m
[00:00:01.533,355] [1B][1;31m<err> fatal_error: Resetting system[1B][0m
ÿ*** Booting nRF Connect SDK v2.5.1 ***
[00:00:00.000,305] [1B][0m<inf> bt_sdc[00:00:00.002,166] [1B][0m<inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)[1B][0m
[00:00:00.002,197] [1B][0m<inf> bt_hci_core: HW Variant: nRF52x (0x0002)[1B][0m
[00:00:00.002,227] [1B][0m<inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017[1B][0m
[00:00:00.002,929] [1B][0m<inf> bt_hci_core: Identity: C2:EF:9A:ED:BB:A1 (random)[1B][0m
[00:00:00.002,960] [1B][0m<inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x1102, manufacturer 0x0059[1B][0m
[00:00:00.002,990] [1B][0m<inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x1102[1B][0m
[00:00:00.003,021] [1B][0m<inf> BLE_LOG: Bluetooth initialized
[1B][0m
[00:00:00.003,967] [1B][0m<inf> BLE_LOG: Advertising successfully started
[1B][0m
[00:00:00.011,810] [1B][1;31m<err> mpsl_init: MPSL ASSERT: 112, 2185[1B][0m
[00:00:00.011,810] [1B][1;31m<err> os: ***** HARD FAULT *****[1B][0m
[00:00:00.011,840] [1B][1;31m<err> os: Fault escalation (see below)[1B][0m
[00:00:00.011,840] [1B][1;31m<err> os: ARCH_EXCEPT with reason 3
[1B][0m
[00:00:00.011,871] [1B][1;31m<err> os: r0/a1: 0x00000003 r1/a2: 0x00000000 r2/a3: 0x00000009[1B][0m
[00:00:00.011,871] [1B][1;31m<err> os: r3/a4: 0x20001010 r12/ip: 0x200009b8 r14/lr: 0x0000adc1[1B][0m
[00:00:00.011,901] [1B][1;31m<err> os: xpsr: 0x41000018[1B][0m
[00:00:00.011,901] [1B][1;31m<err> os: Faulting instruction address (r15/pc): 0x0000f90c[1B][0m
[00:00:00.011,932] [1B][1;31m<err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0[1B][0m
[00:00:00.011,962] [1B][1;31m<err> os: Fault during interrupt handling
[1B][0m
[00:00:00.011,993] [1B][1;31m<err> os: Current thread: 0x20001010 (unknown)[1B][0m
[00:00:01.111,022] [1B][1;31m<err> fatal_error: Resetting system[1B][0m
In advance, I want to express my sincere gratitude for any assistance or guidance provided. Your support is deeply appreciated.
Regards,
Sri