You are reading a single comment by @DFox and its replies. Click here to read the full conversation.
  • I'm trying to persistently connect to 2 BLE devices: a Core temperature sensor and a generic HRM. In addition, I need to read advertising (as manufacturer data) from 2 pucks set up to read thermistors. And do sleep measurement similar to sleeplog. All of the temperature data plus heartrate will also be advertised as manufacturer data from the Bangle.

    The problem I'm having is with the Core sensors. They frequently disconnect and I can't figure out why. I am still able to connect to them with nRF Connect when this happens. Sometimes they are good for an hour or so, but more often than not they disconnect several times an hour/minute and may take several minutes to reconnect. I have tried several cores with the same result. I have also (separately) tried using the Bangle coretemp app with recorder set to a 10 second log rate and run for over 14 hours without seeing any loss of core data. This is only a single connection though.

    The HRM has no such issues. If the connection there is lost while the HRM is still powered and in range, the connection is generally remade on the first try.

    The general idea is first the program connects to the HRM, then the Core, then it starts scanning for advertisements and checking both connections every 10 seconds to ensure they're still up. I've prioritized reconnecting to the HRM first, mainly because it's typically much more reliable. I have tried to ensure that each device locks the other out of connecting while it's trying to, and that I am not scanning for ads during this time. My code is attached, apologies in advance for the length. I have also included a snippet of the data that I've collected including some errors I was able to log. On very rare occasion I've also seen uncaught errors such as "Uncaught InternalError: BLE task completed that wasn't scheduled (SERVICE/NONE)".


    2 Attachments

About

Avatar for DFox @DFox started