This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Breakpoints and fault issue in nRF_Connect_SDK

Hi,

  I am developing application in nRF_connect_SDK v 1.4.2.

I have a problem in Debug the code
1. When i debug the code the breakpoints is not appearing

2. When i pause the code in middle of the debugging it moves to

and when resume the code it returns HARD FAULT and restart the code on next resume clicks

here its terminal logging

x,53,165,36,20,-10480,-2600,-730,-1296,y,-92,-60,1,-43,-1162,7994,-1463,-731,z,-85,-150,-135,-69,-7050,-7809,-1834,-1782
x,54,165,36,20,-10479,-2600,-729,-1297,y,-92,-60,3,-43,-1161,7989,-1462,-731,z,-84,-150,-135,-70,-7050,-7807,-1833,-1781
x,55,166,36,20,-10478,-2600,-729,-1297,y,-92,-60,1,-44,-1161,7990,-1462,-731,z,-85,-151,-133,-72,-7052,-7808,-1836,-1782
x,54,166,36,20,-10479,-2600,-728,-1297,y,-91,-60,2,-44,-1161,7993,-1462,-731,z,-85,-149,-136,-71,-7051,-7806,-1834,-1782
E: MPSL ASSERT: rem.c, 2148
E: ***** HARD FAULT *****
E:   Fault escalation (see below)
E: r0/a1:  0x00000003  r1/a2:  0x00000001  r2/a3:  0x00000001
E: r3/a4:  0x000190cd r12/ip:  0x00000000 r14/lr:  0x000264b3
E:  xpsr:  0x61000018
E: Faulting instruction address (r15/pc): 0x000264be
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x20002fb0 (unknown)
E: Resetting system
Success to get pointer to I2C_0 device.*** Booting Zephyr OS build v2.4.0-ncs2  ***
Starting Bluetooth Peripheral HIDS keyboard example
device is 0x20000ad4, name is MLX90393
I: 6 Sectors of 4096 bytes
I: alloc wra: 0, fd8
I: data wra: 0, 19
I: SoftDevice Controller build revision: 
I: cf 5c 0f 11 88 9c d7 02 |.\......
I: 15 27 c7 c3 ca 60 19 85 |.'...`..
I: b7 c4 50 e3             |..P.    
I: HW Platform: Nordic Semiconductor (0x0002)
I: HW Variant: nRF52x (0x0002)
I: Firmware: Standard Bluetooth controller (0x00) Version 207.3932 Build 3617359889
I: No ID address. App must call settings_load()
Bluetooth initialized
I: Identity: d8:04:fe:a3:7b:24 (random)
I: HCI: version 5.2 (0x0b) revision 0x1123, manufacturer 0x0059
I: LMP: version 5.2 (0x0b) subver 0x1123
Advertising successfully started
x,53,165,36,20,-10481,-2600,-729,-1296,y,-92,-60,2,-44,-1162,7991,-1461,-731,z,-85,-149,-135,-70,-7050,-7807,-1833,-1782
x,53,166,37,20,-10491,-2604,-731,-1298,y,-92,-61,1,-45,-1162,7975,-1465,-732,z,-85,-150,-135,-69,-7058,-7817,-1837,-1785
x,54,166,36,19,-10488,-2603,-730,-1299,y,-92,-59,2,-44,-1162,7989,-1464,-733,z,-85,-150,-135,-71,-7058,-7813,-1834,-1784
x,54,166,37,20,-10488,-2602,-731,-1297,y,-92,-60,2,-44,-1162,7986,-1463,-732,z,-86,-150,-133,-70,-7056,-7815,-1838,-1783

Even same fault error comes in the default peripheral_lbs code

logg

Serial port COM13 opened
*** Booting Zephyr OS build v2.4.0-ncs2  ***
Starting Bluetooth Peripheral LBS example
I: 8 Sectors of 4096 bytes
I: alloc wra: 0, ff0
I: data wra: 0, 0
I: SoftDevice Controller build revision: 
I: cf 5c 0f 11 88 9c d7 02 |.\......
I: 15 27 c7 c3 ca 60 19 85 |.'...`..
I: b7 c4 50 e3             |..P.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
E: MPSL ASSERT: rem.c, 2148
E: ***** HARD FAULT *****
E:   Fault escalation (see below)
E: r0/a1:  0x00000003  r1/a2:  0x00000001  r2/a3:  0x00000001
E: r3/a4:  0x000163f5 r12/ip:  0x00000000 r14/lr:  0x0002152f
E:  xpsr:  0x61000018
E: Faulting instruction address (r15/pc): 0x0002153a
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x200027f8 (unknown)
E: Resetting system
*** Booting Zephyr OS build v2.4.0-ncs2  ***
Starting Bluetooth Peripheral LBS example
I: 8 Sectors of 4096 bytes
I: alloc wra: 0, fd8
I: data wra: 0, 19
I: SoftDevice Controller build revision: 
I: cf 5c 0f 11 88 9c d7 02 |.\......
I: 15 27 c7 c3 ca 60 19 85 |.'...`..
I: b7 c4 50 e3             |..P.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started

Parents
  • Hi,

     

    You cannot break/continue while debugging a BLE connection, as halting will only halt the CPU and not the running peripherals.

    What happens is that a interrupt will be triggered when you resume the CPU, and the softdevice controller will find out-of-order events occurring; thus it asserts.

     

    This is similar when debugging the SoftDevice in nRF5 SDK.

     

    If you have issues reaching breakpoints, please set "CONFIG_DEBUG_OPTIMIZATIONS=y" and see if this helps.

     

    Kind regards,

    Håkon

  • Even Though I Used "CONFIG_DEBUG_OPTIMIZATIONS"

    I am not able to set breakpoints

    In my proj.conf

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_SMP=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Glosdex Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    CONFIG_BT_BAS=y
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="NordicSemiconductor"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # DEBUG
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Config logger
    #CONFIG_LOG=y
    #CONFIG_USE_SEGGER_RTT=y
    #CONFIG_LOG_BACKEND_RTT=y
    #CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    #MLX90393 Enable
    CONFIG_MLX90393=y
    CONFIG_MLX90393_TRIGGER_GLOBAL_THREAD=y
    

    HID service + NUS + BAS are enabled

    and also i tried to print "LOG_INF" in debug terminal

    But during debug

    1. can't able to set breakpoints

    2. Debug terminal is open but not printing the "LOG_INF"

Reply
  • Even Though I Used "CONFIG_DEBUG_OPTIMIZATIONS"

    I am not able to set breakpoints

    In my proj.conf

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_SMP=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Glosdex Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    CONFIG_BT_BAS=y
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="NordicSemiconductor"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # DEBUG
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Config logger
    #CONFIG_LOG=y
    #CONFIG_USE_SEGGER_RTT=y
    #CONFIG_LOG_BACKEND_RTT=y
    #CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    #MLX90393 Enable
    CONFIG_MLX90393=y
    CONFIG_MLX90393_TRIGGER_GLOBAL_THREAD=y
    

    HID service + NUS + BAS are enabled

    and also i tried to print "LOG_INF" in debug terminal

    But during debug

    1. can't able to set breakpoints

    2. Debug terminal is open but not printing the "LOG_INF"

Children
  • Hi,

     

    For logging, you should enable the logging subsys, and set the appropriate info level for your specific module to enable LOG_INF printing.

    For debugging, could you please try the latest version of SES Nordic Edition?

     

    Kind regards,

    Håkon

  • Hi

    I have run the peripheral_uart code there debug terminal works

    but when i combined the code peripheral_hids_keyboard + peripheral_uart the debug terminal gets open but not printing

    the k.config file

    source "Kconfig.zephyr"
    
    menu "Nordic BLE HIDS Keyboard sample"
    
    config NFC_OOB_PAIRING
    	bool "Enable NFC OOB pairing"
    	default y if BOARD_NRF5340PDK_NRF5340_CPUAPP
    	default y if BOARD_NRF52840DK_NRF52840
    	default y if BOARD_NRF52DK_NRF52832
    	select NFC_T2T_NRFXLIB
    	select NFC_NDEF
    	select NFC_NDEF_MSG
    	select NFC_NDEF_RECORD
    	select NFC_NDEF_LE_OOB_REC
    
    config BT_NUS_THREAD_STACK_SIZE
    	int "Thread stack size"
    	default 1024
    	help
    	  Stack size used in each of the two threads
    
    config BT_NUS_UART_BUFFER_SIZE
    	int "UART payload buffer element size"
    	default 20
    	help
    	  Size of the payload buffer in each RX and TX FIFO element
    
    config BT_NUS_SECURITY_ENABLED
    	bool "Enable security"
    	default y
    	select BT_SMP
    	help
    	  "Enable BLE security for the UART service"
    
    config BT_NUS_UART_RX_WAIT_TIME
    	int "Timeout for UART RX complete event"
    	default 50
    	help
    	  Wait for RX complete event time in milliseconds
    endmenu
    

    prj.conf

    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_SMP=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Glosdex Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    CONFIG_BT_BAS=y
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="NordicSemiconductor"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # DEBUG
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    CONFIG_NVS_LOG_LEVEL_DBG=y
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    #MLX90393 Enable
    CONFIG_MLX90393=y
    CONFIG_MLX90393_TRIGGER_GLOBAL_THREAD=y
    
    # NFC configuration
    CONFIG_NFC_OOB_PAIRING=n
    
    # Added
    CONFIG_BT_GATT_CLIENT=y
    

Related