error: k_sys_fatal_error_handler: Resetting system

USING THE PERIPHERAL_UART TO CONNECT WITH THE MULTIPLE CENTRAL DEVICES . I MODIFIED SOME CODE AND ADDED THE CUSTOM DATA WHICH IS HAVING THE 5 BYTES. WHEN I USE TO FLASH THE CODE THE BOARD IS AUTOMATICALLY RESETTING WHETHER THE DEVICE IS CONNECTED NOR CONNECTED . BELOW  I PROVIDE THE LOGS : 

[00:00:04.657,989] <err> os: mem_manage_fault: ***** MPU FAULT *****
[00:00:04.657,989] <err> os: mem_manage_fault: Instruction Access Violation
[00:00:04.658,020] <err> os: esf_dump: r0/a1: 0x200017d8 r1/a2: 0x00000000 r2/a3: 0x20005b00
[00:00:04.658,020] <err> os: esf_dump: r3/a4: 0x20001118 r12/ip: 0x00027f4b r14/lr: 0x0000c9ab
[00:00:04.658,050] <err> os: esf_dump: xpsr: 0x00000000
[00:00:04.658,050] <err> os: esf_dump: Faulting instruction address (r15/pc): 0x20001118
[00:00:04.658,111] <err> os: z_fatal_error: >>> ZEPHYR FATAL ERROR 20: Unknown error on CPU 0
[00:00:04.658,142] <err> os: z_fatal_error: Current thread: 0x20001520 (BT RX)
[00:00:04.658,156] <err> os: z_fatal_error:k_sys_fatal_error_handler: Resetting system
[00:00:00.254,180] <err> qspi_nor: qspi_init: JEDEC id [ff ff ff] expect [c2 28 17]. 

LATER THE RESETTING THE BOARD IT IS SHOWING THE 35 , 12 etc,. MESSAGES DROPPED . 

*** Booting nRF Connect SDK v3.5.99-ncs1 ***

[00:00:00.260,192] <inf> fs_nvs: nvs_mount: 2 Sectors of 4096 bytes
--- 35 messages dropped ---
[00:00:00.283,050] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.4 (0x0d) subver 0x218f
[00:00:00.283,264] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 2
[00:00:00.283,294] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.283,508] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.283,691] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.283,721] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 2
[00:00:00.283,752] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.283,935] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.284,118] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 5
[00:00:00.284,149] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 16
[00:00:00.284,362] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 19
[00:00:00.284,759] <dbg> bt_gatt: bt_gatt_attr_read: handle 0x0000 offset 0 length 19
[00:00:00.285,125] <dbg> bt_gatt: db_hash_gen: Hash:
76 d0 f0 8f 79 93 36 93 d9 4d 30 a4 3e 94 42 ed |v...y.6. .M0.>.B.
[00:00:00.285,125] <dbg> bt_gatt: do_db_hash: Database Hash matches
[00:00:00.285,247] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.285,614] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.286,010] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.286,407] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.286,743] <dbg> bt_conn: bt_conn_set_state: disconnected -> connecting-adv
[00:00:00.286,773] <dbg> bt_conn: bt_conn_ref: handle 0 ref 1 -> 2
[00:00:00.286,865] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.287,292] <dbg> bt_conn: bt_conn_unref: handle 0 ref 2 -> 1
[00:00:00.287,384] <dbg> bt_conn: bt_conn_prepare_events:
[00:00:00.287,750] <dbg> bt_conn: bt_conn_prepare_events: 

and i did some modifications in prj.conf . i provide below :

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
#CONFIG_SERIAL=y

#CONFIG_GPIO=y

# Make sure printk is printing to the UART console
#CONFIG_CONSOLE=y
#CONFIG_UART_CONSOLE=y

CONFIG_HEAP_MEM_POOL_SIZE=4096


CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
CONFIG_BT_MAX_CONN=5
CONFIG_BT_MAX_PAIRED=3
CONFIG_BT_CENTRAL=y
CONFIG_BT_GATT_CLIENT=y
# Enable scanning (passive or active depending on your use case)
CONFIG_BT_SCAN=y
CONFIG_BT_OBSERVER=y
# Enable the NUS service
CONFIG_BT_NUS=y

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

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more stack
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

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

#HARDWARE STACK ENABLE
CONFIG_HW_STACK_PROTECTION=y


CONFIG_ASSERT=n
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEBUG_CONN=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_BT_SMP=y
CONFIG_PRINTK=y
CONFIG_BT_GATT_LOG_LEVEL_DBG=y

#BUFFER SIZE

CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_BUF_ACL_RX_COUNT=61
CONFIG_BT_BUF_ACL_RX_SIZE=83
CONFIG_BT_BUF_ACL_TX_COUNT=10

CONFIG_THREAD_NAME=y

The Application just keep looping around. 

Hope for your valuable suggestions to overcome from this . 

Thank you in Advance.

  • Hello,

    Seeing your log, it says MPU fault (Memory Protection Unit), and instruction access violation, it suggests an overflow, and the log says that the current thread is the BT_RX thread. 

    So what I would try is to increase the BT_RX stack size. You can do so by adding this to your prj.conf:

    CONFIG_BT_RX_STACK_SIZE=4096

    (you can check what your current value is by not writing 4096, and hovering over it with your mouse to see the value in the current build.

    Best regards,

    Edvin

Related