zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.86k stars 6.62k forks source link

Bluetooth : HardFault in hci_driver on sample/bluetooth/periodic_sync using nRF52833DK #51761

Closed rds-tmeyer closed 2 years ago

rds-tmeyer commented 2 years ago

Describe the bug When running the example sample/bluetooth/periodic_sync on a nRF52833DK and sample/bluetooth/periodic_adv on a custom nRF52833 board, the central side crashes with an HardFault as soon as the peripheral starts to advertise. The crashes is an ASSERT that is triggered in the SoftDevice hci_driver :

SoftDevice Controller ASSERT: 12, 136
[00:00:04.634,460] <err> os: ***** HARD FAULT *****
[00:00:04.634,460] <err> os:   Fault escalation (see below)
[00:00:04.634,490] <err> os: ARCH_EXCEPT with reason 3
[00:00:04.634,490] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000006  r2/a3:  0x00000005
[00:00:04.634,521] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0001bf6d
[00:00:04.634,521] <err> os:  xpsr:  0x41000011
[00:00:04.634,552] <err> os: Faulting instruction address (r15/pc): 0x0001bf78
[00:00:04.634,582] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
[00:00:04.634,582] <err> os: Fault during interrupt handling
[00:00:04.634,613] <err> os: Current thread: 0x20001e88 (unknown)
[00:00:05.093,048] <err> os: Halting system

Please also mention any information which could help others to understand the problem you're facing:

To Reproduce Steps to reproduce the behavior:

  1. west build -b [nRF52833dk_nrf52833/custom_board] -p
  2. west flash
  3. Open RTT Viewer of periodic_sync while periodic_adv is off
  4. Turn on periodic_adv and check the log on periodic_sync, HardFault happen almost immediatly when the device starts to advertise.

Expected behavior I expect the periodic_sync application to continue running and displaying a successful sync with the other board.

Impact This is a showstopper since periodic advertising is the basis of the current project.

Logs and console output The code has been modified to not print each scanned device information by commenting this line : https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v3.1.0/samples/bluetooth/periodic_sync/src/main.c#L82

00> .*** Booting Zephyr OS build v3.1.99-ncs1  ***
00> Starting Periodic Advertising Synchronization Demo
00> Checking LED device...done.
00> Configuring GPIO pin...done.
00> [00:00:00.000,396] <inf> sdc_hci_driver: SoftDevice Controller build revision: 
00>                                          f2 e7 5f 6f 23 a2 f3 e8  10 2f c3 35 9e d7 1d fe |.._o#... ./.5....
00>                                          8f 80 42 f9                                      |..B.             
00> [00:00:00.002,929] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
00> [00:00:00.002,960] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
00> [00:00:00.002,960] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 242.24551 Build 4087489391
00> [00:00:00.003,936] <inf> bt_hci_core: Identity: C7:4B:0D:AB:50:FC (random)
00> [00:00:00.003,967] <inf> bt_hci_core: HCI: version 5.3 (0x0c) revision 0x11a7, manufacturer 0x0059
00> [00:00:00.003,967] <inf> bt_hci_core: LMP: version 5.3 (0x0c[0m
00> Scan callbacks register...success.
00> Periodic Advertising callbacks register...Success.
00> Start scanning...success.
00> Start blinking LED...
00> Waiting for periodic advertising...
00> PERIODIC FOUNDFound periodic advertising.
00> Creating Periodic Advertising Sync...success.
00> Waiting for periodic sync...
00> SoftDevice Controller ASSERT: 12, 136
00> [00:00:04.634,460] <err> os: ***** HARD FAULT *****
00> [00:00:04.634,460] <err> os:   Fault escalation (see below)
00> [00:00:04.634,490] <err> os: ARCH_EXCEPT with reason 3
00> 
00> [00:00:04.634,490] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000006  r2/a3:  0x00000005
00> [00:00:04.634,521] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0001bf6d
00> [00:00:04.634,521] <err> os:  xpsr:  0x41000011
00> [00:00:04.634,552] <err> os: Faulting instruction address (r15/pc): 0x0001bf78
00> [00:00:04.634,582] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
00> [00:00:04.634,582] <err> os: Fault during interrupt handling
00> 
00> [00:00:04.634,613] <err> os: Current thread: 0x20001e88 (unknown)
00> [00:00:05.093,048] <err> os: Halting system

Environment (please complete the following information):

Additional context The prj.conf file have been modified to include RTT debugging and the config for the other peripherals. The example coee has not been modified.

CONFIG_BT=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="Test Periodic Advertising Sync"

# General purpose IO controller
CONFIG_GPIO=y

# Power Mangement
CONFIG_PM=y
CONFIG_PM_DEVICE=y

# SPI FLASH
CONFIG_SPI=y
CONFIG_FLASH=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_IDLE_IN_DPD=y

# Accelerometer and TH sensor
CONFIG_I2C=y
CONFIG_SENSOR=y

# RTT debug console
CONFIG_CONSOLE=y
CONFIG_SERIAL=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_SEGGER_RTT_MEMCPY_USE_BYTELOOP=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_LOG=y

# Disable optimizations for easier debugging
CONFIG_DEBUG=y
CONFIG_DEBUG_INFO=y
carlescufi commented 2 years ago

You are using the SoftDevice controller which is not part of Zephyr. Please report this in the Nordic Devzone instead. Thanks! Feel free to reopen or comment if I made a wrong assumption or if you have questions.