BLE Connection Issue with nRF5340 Device

Hello,

I am using the nRF5340 in my project, and the device is capable of communicating with a mobile phone over BLE. However, we occasionally encounter a connection error when trying to connect to the device from our mobile application.

I captured the issue using Wireshark, and the device address at the time was E4:E6:0F:05:AF:C0. The device had sufficient battery and was in close proximity to the phone during the test. Despite this, the connection attempt fails intermittently.

Unfortunately, I couldn’t identify the root cause of the problem from the Wireshark logs. Could you please help me understand what might be causing this connection issue?

Thank you in advance.

e4_e6_0f_05_af_c0 connection error.pcapng

  • I’ve tried optimizing advertisement parameters, service structure, and delayed MTU exchange, but the issue still persists.

    Do you have any official recommendations or best practices to handle large GATT tables during BLE connection establishment on nRF5340 series (or SDK 2.6.1)?

  • Hi,

    One thing you should do in any case is to update to nRF Connect SDK v2.6.4, this will then include some fixes in general that may be relevant. Can you build to get some debug information?

    Normally you can get more information about a fault by adding something like:

    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_DEBUG_THREAD_INFO=y

    # Debugging configuration
    CONFIG_THREAD_NAME=y
    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_ANALYZER_AUTO=y
    CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
    CONFIG_THREAD_ANALYZER_USE_PRINTK=y

    # add asserts
    CONFIG_ASSERT=y
    CONFIG_ASSERT_VERBOSE=y
    CONFIG_ASSERT_NO_COND_INFO=n
    CONFIG_ASSERT_NO_MSG_INFO=n
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_THREAD_NAME=y

    Kenneth

  • I have updated to nRF Connect SDK v2.6.4 as recommended. However, after the update, I noticed a significant increase in power consumption. While my device was previously consuming around 500 µA with SDK v2.6.1, it now draws approximately 4.5 mA.

    Additionally, I disabled the serial in the rpmsg file (set CONFIG_SERIAL=n). Despite the higher current draw, the device is running, and the BLE functionality is working. However, I am still experiencing BLE connection issues.

    I'll share my current prj.conf file below for your review and would appreciate any support in identifying the cause of the increased power consumption and ongoing connection issues.

    # Enable Bootloader 
    CONFIG_BOOTLOADER_MCUBOOT=y
    # Enable APP CORE DFU -- Disable for multicore DFU
    # CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    
    # Enable SMP Server
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_GRP_IMG=y
    
    # CONFIG_MCUMGR_GRP_IMG dependencies
    CONFIG_FLASH=y
    CONFIG_IMG_MANAGER=y
    
    # CONFIG_IMG_MANAGER dependencies
    CONFIG_STREAM_FLASH=y
    
    # CONFIG_MCUMGR dependencies
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    
    # Required for CONFIG_IMG_MANAGER
    CONFIG_FLASH_MAP=y
    CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.1.9+7"
    
    CONFIG_BT=y
    
    CONFIG_BT_SMP=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=n
    CONFIG_BT_BAS=n
    CONFIG_BT_HRS=n
    CONFIG_SNS_SERVICE_ENABLED=y
    CONFIG_ECG_SERVICE_ENABLED=y
    CONFIG_PPG_SERVICE_ENABLED=y
    CONFIG_MOT_SERVICE_ENABLED=y
    CONFIG_COM_SERVICE_ENABLED=y
    CONFIG_BT_DEVICE_NAME="Zephyr Heartrate Sensor"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    
    
    CONFIG_I2C=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    
    CONFIG_GPIO=y
    CONFIG_LED=y
    
    CONFIG_COUNTER=y
    
    
    CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
    CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y
    
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    
    CONFIG_SETTINGS=y
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_I2C=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more stack
    CONFIG_MAIN_STACK_SIZE=1152
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Config logger
    
    
    # HCI ACL buffers size
    # BT_L2CAP_RX_MTU = CONFIG_BT_BUF_ACL_RX_SIZE - BT_L2CAP_HDR_SIZE
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    
    # L2CAP SDU/PDU TX MTU
    CONFIG_BT_L2CAP_TX_MTU=247
    
    CONFIG_BT_HCI_VS=y
    CONFIG_BT_HCI_VS_EXT=y
    
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    
    CONFIG_WATCHDOG=y
    CONFIG_RESET=y
    
    CONFIG_SHELL=n
    
    CONFIG_LOG_CMDS=y
    
    CONFIG_REGULATOR=y
    CONFIG_SENSOR=y
    CONFIG_I2C_SHELL=y
    CONFIG_NRF_FUEL_GAUGE=y
    CONFIG_REQUIRES_FLOAT_PRINTF=y
    
    
    # CONFIG_FLASH_JESD216_API=y
    
    
    CONFIG_NORDIC_QSPI_NOR=y
    
    
    # CONFIG_PM=y
    # CONFIG_PM_DEVICE=y
    
    #### pwm
    CONFIG_PWM=y
    CONFIG_PWM_LOG_LEVEL_DBG=y

  • Hello,

    Unfortunately I don't have any specific recommendations, but maybe you can search through your build folder for zephyr.dts and .config files, and share them here (with name of the folder you find them in the build folder)? Then I can take a look.

    Kenneth

Related