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

UART app shows connected (but actually not) when peripheral bonding data is cleared

Hi,

I tested UART app(nRF Toolbox) by iPhone for scenario: erased bonding info of peripheral but iPhone, then establish connection between iPhone and peripheral.

Here are test result:

1. UART app shows connected (but actually not)  when I erased the bonding info of peripheral early.

2. We can see the logs that the connection isn't established correctly.

The connection is not established is expected.

Does the UART app keep connection is expected?

Can peripheral send notification to UART app, and disconnect the secure link? 

By the way, tn this situation, I understand user should clear bonding info in iPhone manually. 

=====

Hardware: nRF52832

SDK: 16.0.0

Code base: ble_app_hrs_pca10040 S132 

Integrate NUS service to code base.

=====

Thanks. Vick

  • Hi Vick

    The app will think it is connected until it runs into a timeout because it thinks that it's paired to the device. The nRF Toolbox app is only tested with the example projects in our SDK, so the UART app in nRF Toolbox has not been tested with an example using NUS and pairing. When modifying projects and testing towards applications I would suggest using the nRFConnect app instead of the nRF Toolbox application, as it's a lot more versatile.

    The peripheral will not be able to send data to the same app if it has deleted its bonding information, as it won't be connected anywhere and will start advertising again.

    Yes, if a peripheral device has erased its bonding information for some reason, the central device will have to "forget" the device as well in order for both devices to pair with one another again.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for your reply.

    We need NUS + LESC pairing for our project, hence we are verifying different connection scenario.

    Do you mean we don't need to consider this scenario? Because user should never encounter this.

     

    On the other hand, I give a try of nRFConnect app and have some questions:

    a) When I connect to peripheral using nRFConnect by Android, the connection is established directly. There is no LESC pairing process.

    The behavior is different from UART app in nRF Toolbox.

    =>So I tried connect peripheral through Android setting, then LESC pairing process shows up.

     

    b) Also I tried erased the bonding info of peripheral. I click "connect" in nRFConnect is not working. => It make sense.

    So far are those expected? Just want to make sure my test result are correct.

    c) I have also tried the UART service RX Characteristic, and peripheral can receive the data from Phone(Android) successfully.

    I'm wondering to know does nRFConnect tool have source code like UART app for development?

    Thanks. Vick

  • Hi

    It's good practice to test for all thinkable scenarios of course, but as long as there is a way to erase bonding information on both the peripheral and central device, I don't think this will be a problem for you. This is common for all BLE devices using pairing, as the connection will fail if one of the devices has erased the bonding information of the other.

    As for your testing method, it seems sound, and the tests seem expected. nRFConnect for Android /iOS have an option to pair once you have connected to a device and won't do pairing without you initiating it. Have you tested to see if the Android app shows the same "incorrect" connected after the nRF has deleted bonding information?

    c) nRFConnect is not open-source I'm afraid, and is meant to be a tool for assisting BLE developers. We recommend using the nRF Toolbox and/or the Android BLE Library for developing your own mobile apps.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for your reply.

    b) I have test nRFConnect like below:

    [Android] In the test scenario, the logs show "Connection terminated by peer (status 19)

    [iOS] In the test scenario, the logs show Attempting to connect, and seems no timeout.

    Because peripheral keeps connected then disconnected.

     iOS

    I think two different behavior because of design between iOS and Android, right?

    If the bonding data of peripheral has been deleted, App should handle this case right? such as  "Keep the status disconnected" Then user can forget the peripheral in Phone setting.

    c) I see. 

    Thanks. Vick

  • Vick_Chang said:
    I think two different behavior because of design between iOS and Android, right?

     Yes, iOS and Android will behave somewhat differently in a few scenarios, this being one of them it seems. The disconnection reason (status 19) is called whenever the peer is the device initiating the disconnection (defers to 0x13 = GATT CONN TERMINATE PEER USER). So there isn't a way to specifically know that this is the issue when you're struggling to connect.

    Best regards,

    Simon

Related