This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NUS transmitting debug messages as well as my own data

So I'm not sure that this is an error, but it is a little annoying.  I have an application that sends sensor data using ble_nus.  Works great, except that mixed in with my data on the nrfConnect phone app are the messages from the Segger RTT.  I understand that they must by default also use the ble_nus interface and that this helps them show up in the app, but is there a way to turn off their transmission over NUS without turning them off locally in Segger RTT?

Parents
  • I'm not sure how the RTT messages received on your chip are sent over NUS, are you using a default example from the nRF5 SDK or have you modified any of them yourself. The ble_app_uart sample only forwards the messages received over UART.

    Best regards,

    Simon

  • This is a now heavily modified copy of ble_app_template, but there is a fine chance that I'm doing something wrong since this is my first crack at it.  I get a bunch of data from a 6-axis IMU, then just send that data over ble_nus in 244 byte chunks.  On the phone, I see my data, but I also get the rtt messages:

    nRF Connect, 2020-10-21
    NumText (F2:AC:A6:67:73:DA)
    V 14:25:40.945 Connecting to F2:AC:A6:67:73:DA...
    D 14:25:40.945 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D 14:25:41.144 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I 14:25:41.144 Connected to F2:AC:A6:67:73:DA
    V 14:25:41.152 Discovering services...
    D 14:25:41.152 gatt.discoverServices()
    D 14:25:41.163 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I 14:25:41.814 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D 14:25:41.948 [Callback] Services discovered with status: 0
    I 14:25:41.948 Services discovered
    V 14:25:41.953 Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
    - RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e)
    - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e)
       Client Characteristic Configuration (0x2902)
    D 14:25:41.953 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D 14:25:41.954 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
    I 14:25:42.038 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    V 14:25:43.247 Enabling notifications for 6e400003-b5a3-f393-e0a9-e50e24dcca9e
    D 14:25:43.247 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
    D 14:25:43.248 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
    I 14:25:43.343 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    A 14:25:43.343 "Notifications enabled" sent
    V 14:25:43.344 Notifications enabled for 6e400003-b5a3-f393-e0a9-e50e24dcca9e
    I 14:25:45.240 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 00-2C-FF-C8-FF-D2-00-02-00-09-00-07-00-00-00-00-00-00-00-2D-FF-C7-FF-D0-FF-FE-FF-F5-FF-FE-00-2D-FF-C7-FF-D0-00-07-FF-FF-FF-FF-00-2E-FF-C8-FF-D2-00-03-FF-F9-00-05-00-2E-FF-C8-FF-D4-00-02-00-06-FF-FB-00-00-00-00-00-00-00-2C-FF-C8-FF-D4-FF-FA-FF-FE-00-0B-00-2D-FF-C6-FF-D1-FF-F6-FF-E4-00-02-00-2E-FF-C6-FF-D2-FF-FF-FF-FA-00-01-00-2C-FF-C7-FF-D1-FF-F9-FF-F1-00-00-00-00-00-00-00-00-00-2C-FF-C8-FF-D2-FF-FC-00-00-00-04-00-2E-FF-C7-FF-D2-00-00-FF-FE-00-03-00-2D-FF-C7-FF-D2-00-02-FF-FD-00-00-00-2D-FF-C8-FF-D2-00-08-FF-FA-00-04-00-00-00-00-00-00-00-2D-FF-C7-FF-D3-FF-FB-00-00-FF-FA-00-2C-FF-C7-FF-D3-00-01-00-09-00-01-00-2C-FF-C6-FF-D2-FF-FF-FF-FD-00-02-00-2C-FF-C7-FF-D1-FF-F7-FF-F6-FF-F8-00-00-00-00-00-00-00-2C-FF-C7-FF-D2-00-0B-00-01
    A 14:25:45.240 "�,����� � � �������-�����������-����� �����.����� ��� �.����� � ���������,��������� �-��������� �.��������� �,�����������������,��������� �.��������� �-����� �����-����� ��� �������-�����������,����� � � �,��������� �,�����������������,����� � " received
    ...
    I 14:25:49.629 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) FF-AB-FF-3D-00-AF-FF-89-FF-39-FF-8C-FF-89-FE-93-01-09-FF-2E-FF-C9-FF-F5-FF-B3-00-00-00-00-00-00-FE-2B-01-AD-FE-E2-00-50-00-23-FF-A6-FE-30-02-58-FE-AC-00-2F-00-08-FF-FE-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-53-45-47-47-45-52-20-52-54-54-00-00-00-00-00-00-02-00-00-00-02-00-00-00-40-8E-03-00-64-53-00-20-00-02-00-00-45-00-00-00-45-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-40-8E-03-00-64-55-00-20-10-00-00-00-00-00-00-00-00-00-00-00
    A 14:25:49.629 "���=�����9������ �.�������������+ ����P�#���0 X���/� ��������������������������������������������������������������������������������������������������SEGGER RTT������ ��� ���@� �dS� � ��E���E�������������������������������@� �dU� �����������" received
    I 14:25:49.778 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20-6E-72-66-5F-73-64-68-5F-62-6C-65-3A-20-42-4C-45-20-65-76-65-6E-74-3A-20-30-78-35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20-6E-72-66-5F-73-64-68-5F-62-6C-65-3A-20-42-4C-45-20-65-76-65-6E-74-3A-20-30-78-35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20
    A 14:25:49.778 "57.
    <info> app: BLE event received. Event type = 87
    
    <debug> nrf_sdh_ble: BLE event: 0x57.
    <info> app: BLE event received. Event type = 87
    
    <debug> nrf_sdh_ble: BLE event: 0x57.
    <info> app: BLE event received. Event type = 87
    
    <debug> " received
    I 14:25:49.929 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    A 14:25:49.929 "����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������" received
    ...

    To actually send the data, it's just breaking the buffer into 244 byte chunks (easy enough) and sending them with

    while (ble_nus_tx_complete == 0);
                err_code = ble_nus_data_send(&m_nus, ble_data_buffer + (BLE_NUS_MAX_DATA_LEN * i++), &length, m_conn_handle);

    That's the only line I have that does any transmission.  So I shouldn't be seeing the informational/debug messages in the nrfConnect app?

    **EDIT** So I'm guessing that I am sending too many data over nus and the pointer is over counting and running outside of my buffer and into the memory with the debug messages.  I'll take a look.  I just thought that it was normal :-P

Reply
  • This is a now heavily modified copy of ble_app_template, but there is a fine chance that I'm doing something wrong since this is my first crack at it.  I get a bunch of data from a 6-axis IMU, then just send that data over ble_nus in 244 byte chunks.  On the phone, I see my data, but I also get the rtt messages:

    nRF Connect, 2020-10-21
    NumText (F2:AC:A6:67:73:DA)
    V 14:25:40.945 Connecting to F2:AC:A6:67:73:DA...
    D 14:25:40.945 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D 14:25:41.144 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I 14:25:41.144 Connected to F2:AC:A6:67:73:DA
    V 14:25:41.152 Discovering services...
    D 14:25:41.152 gatt.discoverServices()
    D 14:25:41.163 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I 14:25:41.814 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D 14:25:41.948 [Callback] Services discovered with status: 0
    I 14:25:41.948 Services discovered
    V 14:25:41.953 Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
    - RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e)
    - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e)
       Client Characteristic Configuration (0x2902)
    D 14:25:41.953 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D 14:25:41.954 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
    I 14:25:42.038 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    V 14:25:43.247 Enabling notifications for 6e400003-b5a3-f393-e0a9-e50e24dcca9e
    D 14:25:43.247 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
    D 14:25:43.248 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
    I 14:25:43.343 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    A 14:25:43.343 "Notifications enabled" sent
    V 14:25:43.344 Notifications enabled for 6e400003-b5a3-f393-e0a9-e50e24dcca9e
    I 14:25:45.240 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 00-2C-FF-C8-FF-D2-00-02-00-09-00-07-00-00-00-00-00-00-00-2D-FF-C7-FF-D0-FF-FE-FF-F5-FF-FE-00-2D-FF-C7-FF-D0-00-07-FF-FF-FF-FF-00-2E-FF-C8-FF-D2-00-03-FF-F9-00-05-00-2E-FF-C8-FF-D4-00-02-00-06-FF-FB-00-00-00-00-00-00-00-2C-FF-C8-FF-D4-FF-FA-FF-FE-00-0B-00-2D-FF-C6-FF-D1-FF-F6-FF-E4-00-02-00-2E-FF-C6-FF-D2-FF-FF-FF-FA-00-01-00-2C-FF-C7-FF-D1-FF-F9-FF-F1-00-00-00-00-00-00-00-00-00-2C-FF-C8-FF-D2-FF-FC-00-00-00-04-00-2E-FF-C7-FF-D2-00-00-FF-FE-00-03-00-2D-FF-C7-FF-D2-00-02-FF-FD-00-00-00-2D-FF-C8-FF-D2-00-08-FF-FA-00-04-00-00-00-00-00-00-00-2D-FF-C7-FF-D3-FF-FB-00-00-FF-FA-00-2C-FF-C7-FF-D3-00-01-00-09-00-01-00-2C-FF-C6-FF-D2-FF-FF-FF-FD-00-02-00-2C-FF-C7-FF-D1-FF-F7-FF-F6-FF-F8-00-00-00-00-00-00-00-2C-FF-C7-FF-D2-00-0B-00-01
    A 14:25:45.240 "�,����� � � �������-�����������-����� �����.����� ��� �.����� � ���������,��������� �-��������� �.��������� �,�����������������,��������� �.��������� �-����� �����-����� ��� �������-�����������,����� � � �,��������� �,�����������������,����� � " received
    ...
    I 14:25:49.629 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) FF-AB-FF-3D-00-AF-FF-89-FF-39-FF-8C-FF-89-FE-93-01-09-FF-2E-FF-C9-FF-F5-FF-B3-00-00-00-00-00-00-FE-2B-01-AD-FE-E2-00-50-00-23-FF-A6-FE-30-02-58-FE-AC-00-2F-00-08-FF-FE-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-53-45-47-47-45-52-20-52-54-54-00-00-00-00-00-00-02-00-00-00-02-00-00-00-40-8E-03-00-64-53-00-20-00-02-00-00-45-00-00-00-45-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-40-8E-03-00-64-55-00-20-10-00-00-00-00-00-00-00-00-00-00-00
    A 14:25:49.629 "���=�����9������ �.�������������+ ����P�#���0 X���/� ��������������������������������������������������������������������������������������������������SEGGER RTT������ ��� ���@� �dS� � ��E���E�������������������������������@� �dU� �����������" received
    I 14:25:49.778 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20-6E-72-66-5F-73-64-68-5F-62-6C-65-3A-20-42-4C-45-20-65-76-65-6E-74-3A-20-30-78-35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20-6E-72-66-5F-73-64-68-5F-62-6C-65-3A-20-42-4C-45-20-65-76-65-6E-74-3A-20-30-78-35-37-2E-0D-0A-3C-69-6E-66-6F-3E-20-61-70-70-3A-20-42-4C-45-20-65-76-65-6E-74-20-72-65-63-65-69-76-65-64-2E-20-45-76-65-6E-74-20-74-79-70-65-20-3D-20-38-37-0D-0A-0D-0A-3C-64-65-62-75-67-3E-20
    A 14:25:49.778 "57.
    <info> app: BLE event received. Event type = 87
    
    <debug> nrf_sdh_ble: BLE event: 0x57.
    <info> app: BLE event received. Event type = 87
    
    <debug> nrf_sdh_ble: BLE event: 0x57.
    <info> app: BLE event received. Event type = 87
    
    <debug> " received
    I 14:25:49.929 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    A 14:25:49.929 "����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������" received
    ...

    To actually send the data, it's just breaking the buffer into 244 byte chunks (easy enough) and sending them with

    while (ble_nus_tx_complete == 0);
                err_code = ble_nus_data_send(&m_nus, ble_data_buffer + (BLE_NUS_MAX_DATA_LEN * i++), &length, m_conn_handle);

    That's the only line I have that does any transmission.  So I shouldn't be seeing the informational/debug messages in the nrfConnect app?

    **EDIT** So I'm guessing that I am sending too many data over nus and the pointer is over counting and running outside of my buffer and into the memory with the debug messages.  I'll take a look.  I just thought that it was normal :-P

Children
No Data
Related