DevAcademy Bluetooth LE connection problems

Hi,

I am going through the DevAcademy Bluetooth LE lessons, using nRF5 DK. But I run into problems directly in the exercise of the first lesson. Everything goes fine to step 4.2, but connecting doesn’t work. Connection is established, but almost immediately disconnection happens. LED2 is lit for a short moment. The print outs are like this:

No matter how many times I try, disconnection always happens this way. I have also tested to connect via the Bluetooth low energy desktop app using the Nordic BLE dongle. Then the connection works fine. I have tested with both nRF Connect SDK 2.3.0 and 2.0.0, and the scenario is the same for both versions.

In the desktop app it is possible to read the button state and activate notifications (and receive updates when the button is pressed). But I am not able to control LED3. I have put a breakpoint in write_led() in lbs.c (C:\...\v2.3.0\nrf\subsys\bluetooth\services\lbs.c), but the breakpoint isn't hit when I write to the LED characteristic. Though, a breakpoint in read_button() will be hit when I click "Nordic LED and Button Service", so I should be in the correct file.

 

Best regards,

Lars

Parents
  • Hello

    What phone and OS are you using when the connection doesn't work? It could be the case that the connection parameters aren't compatible with your phone OS or something similar.

    If you could set up a BLE sniffer and share logs of the communication between your devices as the disconnection happens, that would be very helpful.

    Best regards,

    Einar

  • Hi,

    I have a Samsung S21 5G with Android version 13. My computer runs Windows 10.

    Now I have installed the BLE Sniffer and captured some communication. In this file I should have recorded two attempts to connect.

    Best regards,
    Lars

    4214.Capture.pcapng

  • That's the problem, I can't make it not work anymore. After the last part of lesson 3 exercise 2, connection always works. And that part has to do with some connection parameters (data length and time). Can something in this process have affected my phone to behave differently in coming connections?

    It's a little while ago so I don't really remember, but most likely the file "Capture dk and phone, 3 tries.pcapng" is capture from lesson 1. As the two files I attached in previous post.

    Can you say something about the red mark in packet 214? Why is it red when corresponding packet in another capture is not red? They look pretty much the same, apart from the red-marked comes after LL_CONNECTION_UPDATE_IND.

    Another thing that I have encountered is that during these connection problems I have run the desktop program. Every time that I power on the dk that I used with the desktop program (I am playing with two dk:s) the PC automatically connects to it. I go into Windows settings and tell the computer to forget the device. Everything seems to work (the device disappears from the device list), but nonetheless the computer connects to it when it is turned on. I have manually added the dk, and then removed it, but it doesn't help. The computer connects to the dk no matter if it is in the list or not. The only way that I have found out to prevent my computer to connect to it is to turn off Bluetooth in the computer. Is there anything I can do to make the computer to really forget my dk?

    /Lars

  • Hi again,

    The last part in previous post is solved. I had to restart my computer, and after that there is no automatic connection.

    /Lars

  • Lars M said:
    After the last part of lesson 3 exercise 2, connection always works. And that part has to do with some connection parameters (data length and time).

    Then it seems like this was the tweaking of parameters needed to make it work, and it also seems like your phone remembers these parameters. Hard to say exactly what made the difference without being able to reproduce the error though.

    Lars M said:
    Can you say something about the red mark in packet 214? Why is it red when corresponding packet in another capture is not red? They look pretty much the same, apart from the red-marked comes after LL_CONNECTION_UPDATE_IND.

    The red mark seems to indicate an unexpected sequencing of packets yes, the peripheral sending a PHY_REQ when the central expects a reply to its CONNECTION_UPDATE_IND.

  • Then it seems like this was the tweaking of parameters needed to make it work, and it also seems like your phone remembers these parameters.

    Ok, it's maybe like that. Though, it would be nice to know it for sure. But maybe it's hard to get to know that.

    But if it is like this, these update of parameters used in lesson 3 exercise 2 should be present in all BLE-programs to prevent a phone to behave like mine.

    /Lars

  • Hi again,

    Another thing that makes this not really satisfactory is that I had my phone working with my own-made BLE-project at the same time as the phone didn't work with the DevAcademy-projects. For my project, the phone didn't send LL_CONNECTION_UPDATE_IND as every other time when the connection works.

    I have made my own BLE-program (called MMS), which is a light version of NUS. Here the connection works fine. It is also possible to send characters to and receive notifications from my dk, and also disconnect. The only difference in the connection process seems to be the lack of LL_CONNECTION_UPDATE_IND in my project.

    So maybe there is more to this than just the possibility that the parameter updates have made my phone behave in a new way. It obviously behaved differently depending on project before.

    /Lars

Reply
  • Hi again,

    Another thing that makes this not really satisfactory is that I had my phone working with my own-made BLE-project at the same time as the phone didn't work with the DevAcademy-projects. For my project, the phone didn't send LL_CONNECTION_UPDATE_IND as every other time when the connection works.

    I have made my own BLE-program (called MMS), which is a light version of NUS. Here the connection works fine. It is also possible to send characters to and receive notifications from my dk, and also disconnect. The only difference in the connection process seems to be the lack of LL_CONNECTION_UPDATE_IND in my project.

    So maybe there is more to this than just the possibility that the parameter updates have made my phone behave in a new way. It obviously behaved differently depending on project before.

    /Lars

Children
Related