BT NUS logging blocked

In our development using NCS-2.6.1 it is desirable to have logs using BT NUS. 

"Serial Bluetooth Terminal" android application is used.

For testing purposes NCS\v3.0.2\nrf\samples\bluetooth\central_and_peripheral_hr been used with modification to support ble logging with next lines added to prj.conf

CONFIG_LOG_BACKEND_BLE=y
CONFIG_LOG=y
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
# Uncomment to use the maximum buffer size
CONFIG_BT_L2CAP_TX_MTU=600
CONFIG_BT_BUF_ACL_RX_SIZE=600
CONFIG_BT_NUS_LOG_LEVEL_DEFAULT=y

CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_BACKEND_UART=y

PCA10056 boards been used for testing with central_and_peripheral_hr and peripheral_hr.

Logs are blocked in case when phone app connected to firmware app implementing central and peripheral and peripheral device connects. Logs filled with "<wrn> bt_gatt: Device is not subscribed to characteristic." messages. Disconnecting peripheral does not recover logging.

Same happens if nRF Toolbox is used

Note that in case when firmware app implementing central and peripheral and peripheral device connected first and after that phone app connects then logging is OK.

Parents
  • Hi Ivan,

    It seems the problem is not related to Nordic UART Service (NUS), it is related to Bluetooth logging backend (log backend BLE). As we unrested you need to customize the connections control mechanism for this service if you are having multiple connections. Below is a simple solution that can solve the problem you have. With this modification, if you connect the mobile phone to central_peripheral_hr first and then connect peripheral_hr board, it will work fine. While this is a simple workaround, it is recommended to implement your own mechanism while considering all connection scenarios. 
    In below screenshot you can see the minor modification to "log_backend_ble_connect" and "log_backend_ble_disconnect". Just make sure to include "conn_internal.h" to the "log_backend_ble.c" file. 
     





Reply
  • Hi Ivan,

    It seems the problem is not related to Nordic UART Service (NUS), it is related to Bluetooth logging backend (log backend BLE). As we unrested you need to customize the connections control mechanism for this service if you are having multiple connections. Below is a simple solution that can solve the problem you have. With this modification, if you connect the mobile phone to central_peripheral_hr first and then connect peripheral_hr board, it will work fine. While this is a simple workaround, it is recommended to implement your own mechanism while considering all connection scenarios. 
    In below screenshot you can see the minor modification to "log_backend_ble_connect" and "log_backend_ble_disconnect". Just make sure to include "conn_internal.h" to the "log_backend_ble.c" file. 
     





Children
No Data
Related