BLE advertising cannot be stop without hardware crash

Hye,

using the nrf 2.4.2 toolchain

i have an unsolvable problem about ble on a nrf52840 based project with imu, i2s strip led, buttons, spi speaker...

i have a classic ble enable process at startup after everthing else initialized (i try disabling all around too... same)

i get a systematic crash on advertising stop with bt_le_adv_stop();

i tried a lot of things about irq conflict or configs...

i tried to put in thread allowing to start and stop advertising few times but a crash anyway 

it just reboot with HARDWARE reset cause (12).

relevant config is for now:

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XXX"
CONFIG_BT_GATT_CLIENT=y
#CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_EXT_ADV=y
CONFIG_ZERO_LATENCY_IRQS=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ULL_HIGH_PRIO=2
CONFIG_BT_MAX_CONN=1

CONFIG_ISR_STACK_SIZE=1024

CONFIG_BT_DIS=y
CONFIG_BT_DIS_FW_REV=y
CONFIG_BT_DIS_MODEL="xxxxxx"
CONFIG_BT_DIS_MANUF="xxxxxx"
CONFIG_BT_DIS_PNP=n
CONFIG_BT_SETTINGS=y
CONFIG_BT_GATT_CACHING=n
CONFIG_BT_DIS_SETTINGS=y
CONFIG_BT_THROUGHPUT=y

CONFIG_BT_GATT_DM=y
CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_L2CAP_TX_MTU=498
also the project use FOTA:

CONFIG_MCUMGR=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_STAT=y
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
CONFIG_DISABLE_FLASH_PATCH=y
thanks
 
  • Thank you!

    Ok, so 0x10 is bit 5, and 0x12 is bit 2 and 5. The RESETREAS register, that is used for the hwinfo_get_reset_cause is retained, so it is not reset unless you do it in the application (or a power on reset). 

    Bit 2 = RESET_BROWNOUT
    Bit 5 = RESET_DEBUG

    From what I can tell, there is nothing in z_impl_hwinfo_get_reset_cause() from the file ncs\zephyr\drivers\hwinfo\hwinfo_nrf.c that can trigger bit 2 (Reset brownout), which makes sense, because there is no bit in the RESETREAS register that will indicate a brownout. 

    Bit 5 (RESET_DEBUG) means:

    "Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"

    In case of a power on reset or a brownout reset, the register should be 0x00000000, giving a reset reason = 0. But since it is cumulative, it means that all reset reasons since the last power on/brownout are added to the list. 

    But I am still not sure how you are able to get bit 2 set in the reset reason number. It should not be possible with an nRF, as there is no check in the hwinfo_get_reset_cause() that sets bit 2. 

    Best regards,

    Edvin

Related