Easy ways to debug BLE connectivity issues

Are there any convenient ways to debug BLE connectivity issues? I have the service up and running but the connection on nRFConnect App doesn't quite go through: it remains stuck on "Connecting" state.

It was working all fine until of a sudden and I can't seem to figure out what went wrong

Parents
  • Hello,

    The most convenient way of debugging connectivity issues is to use the nRF Sniffer tool - are you already familiar with this? It is a powerfull tool to wield when developing and debugging with BLE, since it lets you monitor the on-air traffic.
    It does however require an extra piece of hardware to act as the sniffer - you can see a list of supported devices in the sniffer's documentation.

    Best regards,
    Karl

  • Alright. It gets frustrating at times when you try to follow along and still don't make it through. I programmed the nRF Sniffer firmware but in wireshark, I don't see the nRF Sniffer COM PORT showing up. Plus I can't seem to get the interface toolbar as shown in the screenshot here. I also have the nRF Sniffer API folder which has a bunch of python files but the link you shared doesn't seem to talk about it. 

    Also, in my case, BLE doesn't even connect. Do you still think nRF Sniffer tool would be useful? Can I not use nRF Connect on my desktop? Scan devices option is greyed out let alone any scanned devices


    Any quick support is appreciated

  • which device are you using to do the BLE scanning in the nRF Connect desktop application, or which device have you programmed with the sniffer's connectivity hex

    I only see one device in nRF Connect desktop app which is my nRF52840. I was trying to simulate on my desktop what I see on the mobile app basically. The desktop app doesn't seem to work the same way though: it doesn't let me scan until I select a device but why?

    Are you trying to connect your nRF Connect desktop application to your nRF Connect smartphone application?

    Ah, no! I already mentioned in this response that I'm trying to simulate on the desktop with the phone app to see if there's an issue with the phone app itself.

    1. I tried following the steps in the tutorial but I can't seem to find the COM PORT in wireshark.

    2. Is this really needed to debug my issue since I can't even connect to my profile all of a sudden (which I was previously able to!).

    3. Is it possible to have a live debug session to help solve the issue a bit faster?

    Thanks

  • Alright. So I tested one more time and I'm fairly certain it's the app that's not functioniong as expected! In the program, ble_evt_handler is invoked and I see the Connect print as soon I attempt to connect from the phone app, but since it doesn't "connect" on the phone app, i don't see any profiles. Are you aware of the issue?

  • Hello again, Morpho

    morpho said:
    I only see one device in nRF Connect desktop app which is my nRF52840. I was trying to simulate on my desktop what I see on the mobile app basically. The desktop app doesn't seem to work the same way though: it doesn't let me scan until I select a device but why?

    Oh, this is because the nRF Connect BLE desktop application requires a nRF device to act as its BLE adapter. The nRF Connect application will prompt you to program the device when you select it from the dropdown menu - it will then program the connectivity firmware it needs to be able to communicate with the device.
    You may then have this device do either scanning or advertising, as you would like. In the central / scanner case you could just click "start scan", but in the advertising / peripheral case you will need to first configure it as a GATT server (different button at the top).

    morpho said:

    Ah, no! I already mentioned in this response that I'm trying to simulate on the desktop with the phone app to see if there's an issue with the phone app itself.

    1. I tried following the steps in the tutorial but I can't seem to find the COM PORT in wireshark.

    I am still having a hard time understanding exactly what you are trying to achieve here. I am under the impression that you are looking for a way to debug a peripheral application's connectivity / connection issues, is this correct?

    If so, I would recommend the following approach:
    - Make sure that the peripheral is programmed and running as expected. Is there any indication that the program is running, and the device has started advertising? What does the log's (if enabled) say?
    - When you have confirmed that the peripheral is functioning as expected, and that it is advertising, we can move on to debugging the connection itself.
    - Choose either the nRF Sniffer or the nRF Connect for Desktop's BLE application to proceed with. The nRF Sniffer gives the complete picture of what is happening on-air between two devices, and can quickly highlight issues within a connection, or issues with advertising.
    The nRF Connect for Desktop's BLE application quickly gives a good overview, and visualizes how the peripheral will look to a scanning central device.

    So, if your issue is with which profiles, services, and characteristics is exposed - choose nRF Connect for desktop. If your issue is with connection throughput, latency, request rejections, or other connection-specific technicalities, choose the nRF Sniffer.

    morpho said:
    Alright. So I tested one more time and I'm fairly certain it's the app that's not functioniong as expected! In the program, ble_evt_handler is invoked and I see the Connect print as soon I attempt to connect from the phone app, but since it doesn't "connect" on the phone app, i don't see any profiles. Are you aware of the issue?

    Could you confirm for me whether you are referring to the program running on the peripheral when you say application?
    I am not aware of any such issue, no. Are you working with a custom application, or are you testing this with a specific example? In case of the latter,, which example?
    It would be great if you could share the peripheral's logs with me as well. You could do so by using the Insert -> Code -> Text option here on DevZone.

    Could you also elaborate what you mean when you say that the peripheral prints connect when the nRF Connect for Smartphone application attempts to connect, but 'it doesn't "connect" on the phone app'?

    Best regards,
    Karl

  • the nRF Connect BLE desktop application requires a nRF device to act as its BLE adapter. The nRF Connect application will prompt you to program the device when you select it from the dropdown menu - it will then program the connectivity firmware it needs to be able to communicate with the device.

    right, but how does the phone app work then? I already have my FW running on nRF MCU and I use the app to connect to the BLE profile.

    I am under the impression that you are looking for a way to debug a peripheral application's connectivity / connection issues, is this correct?

    Okay, so ALL i'm trying to do is: create a custom BLE service, and add read/write characteristics to read/send the attribute values. PREVIOUSLY, I have been able to connect to the BLE profile via nRF Connect phone app, but lately i have been seeing issues with nRF Connect app showing it's not CONNECTED, despite the ble_evt_handler getting invoked with a BLE_GAP_EVT_CONNECTED parameter passed in.

    I even tried the existing samples from the SDK including the ble_nus app, and it behaves the same way: nRF app doesn't show it's connected/i don't see any profiles but the ble_evt_handler does get passed with BLE_GAP_EVT_CONNECTED.

    To me, it looks like connection does happen and there's an issue with the app itself.

    Could you confirm for me whether you are referring to the program running on the peripheral when you say application?

    I mean my program/FW is programmed on the said nRF device

    Could you also elaborate what you mean when you say that the peripheral prints connect when the nRF Connect for Smartphone application attempts to connect, but 'it doesn't "connect" on the phone app'?

    that's what I mean

  • Hello Morpho,

    morpho said:
    right, but how does the phone app work then? I already have my FW running on nRF MCU and I use the app to connect to the BLE profile.

    Most smartphones already have a available BLE adapter, so the nRF Connect for smartphone application will use this instead of needing an external device.

    morpho said:

    Okay, so ALL i'm trying to do is: create a custom BLE service, and add read/write characteristics to read/send the attribute values. PREVIOUSLY, I have been able to connect to the BLE profile via nRF Connect phone app, but lately i have been seeing issues with nRF Connect app showing it's not CONNECTED, despite the ble_evt_handler getting invoked with a BLE_GAP_EVT_CONNECTED parameter passed in.

    I even tried the existing samples from the SDK including the ble_nus app, and it behaves the same way: nRF app doesn't show it's connected/i don't see any profiles but the ble_evt_handler does get passed with BLE_GAP_EVT_CONNECTED.

    To me, it looks like connection does happen and there's an issue with the app itself.

    Aha - now I understand what you meant earlier. Thank you for elaborating, this made you issue much more clear to me!
    This does indeed definitely sound like it could be an issue with the nRF Connect for Smartphones application. Could I ask which phone you are using the nRF Connect application with, and what version of the application you are using?
    I will try to reproduce this on my end so that I may raise an internal ticket on this to have it examined, if I am able to reproduce it properly.

    morpho said:
    that's what I mean

    How does the Client tab look? Could you also show me the logs from the nRF Connect application? You could click the 'Log' button to see these.
    What does the log on the nRF Connect's side say when you connect to a peripheral device (as indicated by the connected event on the peripheral side)?

    Best regards,
    Karl

Reply
  • Hello Morpho,

    morpho said:
    right, but how does the phone app work then? I already have my FW running on nRF MCU and I use the app to connect to the BLE profile.

    Most smartphones already have a available BLE adapter, so the nRF Connect for smartphone application will use this instead of needing an external device.

    morpho said:

    Okay, so ALL i'm trying to do is: create a custom BLE service, and add read/write characteristics to read/send the attribute values. PREVIOUSLY, I have been able to connect to the BLE profile via nRF Connect phone app, but lately i have been seeing issues with nRF Connect app showing it's not CONNECTED, despite the ble_evt_handler getting invoked with a BLE_GAP_EVT_CONNECTED parameter passed in.

    I even tried the existing samples from the SDK including the ble_nus app, and it behaves the same way: nRF app doesn't show it's connected/i don't see any profiles but the ble_evt_handler does get passed with BLE_GAP_EVT_CONNECTED.

    To me, it looks like connection does happen and there's an issue with the app itself.

    Aha - now I understand what you meant earlier. Thank you for elaborating, this made you issue much more clear to me!
    This does indeed definitely sound like it could be an issue with the nRF Connect for Smartphones application. Could I ask which phone you are using the nRF Connect application with, and what version of the application you are using?
    I will try to reproduce this on my end so that I may raise an internal ticket on this to have it examined, if I am able to reproduce it properly.

    morpho said:
    that's what I mean

    How does the Client tab look? Could you also show me the logs from the nRF Connect application? You could click the 'Log' button to see these.
    What does the log on the nRF Connect's side say when you connect to a peripheral device (as indicated by the connected event on the peripheral side)?

    Best regards,
    Karl

Children
  • Could I ask which phone you are using the nRF Connect application with, and what version of the application you are using?

    App version 2.4.12, and it's an iOS app.

    What does the log on the nRF Connect's side say when you connect to a peripheral device (as indicated by the connected event on the peripheral side)?

    Turning Off Scanner...
    Scanner On.
    Device Scanned.
    [Callback] centralManager(central, didDiscover: peripheral, advertisementData: ["kCBAdvDataRxSecondaryPHY": 0, "kCBAdvDataTimestamp": 656911790.671123, "kCBAdvDataServiceUUIDs": <__NSArrayM 0x28272db00>(
    F3641400-00B0-4240-BA50-05CA45BF8ABC
    )
    , "kCBAdvDataIsConnectable": 1, "kCBAdvDataRxPrimaryPHY": 1, "kCBAdvDataLocalName": Xyp-CUS], rssi: -62)
    Attempting to connect...
    cbCentralManager.connect()

  • morpho said:
    App version 2.4.12, and it's an iOS app.

    Thank you for clarifying.
    I just tested this on an iPhone X with the 2.4.12 version without issues - testing against the ble_app_uart application.
    Are these the only loggings available in the "Log" section during a connection? Does it not show anything about service discovery and connection parameter updates, etc?

    I know that iOS devices sometimes might experience a caching issue if their bluetooth adapter has been on for a long time. Could you try this again after having turned off and on again the phone's bluetooth?
    If this does not resolve the issue, could you try this again after uninstalling and reinstalling the nRF Connect application for smartphone entirely?

    Best regards,
    Karl

  • could you try this again after uninstalling and reinstalling the nRF Connect application for smartphone entirely?

    I actually tried this the first time it happened, and it solved the issue but this time i have tried like 4-5 times to no avail

  • morpho said:
    I actually tried this the first time it happened, and it solved the issue but this time i have tried like 4-5 times to no avail

    That sounds very peculiar indeed. I have not heard of anyone else experiencing this either yet, but I will file an internal ticket with the developers of the application so that they could be aware of it.

    Before I do so, could you try to clear the app's cache too, to see if this perhaps fixes the issue?
    And just to have it confirmed, the issue is that the view in the screenshot you sent does not change to 'connected' right? It only ever says 'connecting' when this happens?

    Best regards,
    Karl

  • Yes, it says Connecting even though I think it's connected as mentioned earlier. How do you clear the app's cache? In settings?

Related