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

NRF52840 dongle running blinky connects with nRF connect app but wont pair to native Android Bluetooth utility

I'm running the unmodified blinky example on the 52840 dongle PCA10059 and it connects just fine with the nrf connect app but will not pair with the phone via the Android native "Pair new device" dialog. It's advertising but clicking on the "Nordic_Blinky" advertisement does nothing.  I have a custom app that I'm trying to connect to the dongle and it doesn't connect either. What am I missing here?

Parents
  • Hi,

    The reason it won't pair is because the native android bluetooth utility allows for pairing so the phone sends a pairing request. The blinky examples does not support pairing/bonding at all so when you try to connect it will fail. Our nRF Connect when pressing "Connect" just sends a Connection Indication, which is why you are able to connect. However, you may click 3 dots on the "Connect" button and select "Bond" which is the same as the native android bluetooth utility.

  • Hi,

    I suggest you take a look at our UART example.

  • What I've done is take the blinky example and added a custom service and the CLI capability, so ideally I'd like to add the pairing/bonding stuff to my current code base rather than start over with an example that supports paring, such as HRS.

    Here's what I have done: I compiled and ran the HRS example (which does support the 10059) without modification was able to pair to that. I then looked through the HRS main.c to see what is different in the ble event handling. I made the following changes to my (working) code base: 

    - added peer_manager_init, delete_bonds, pm_evt_handler (straight from the HRS example)

    - added the call to peer_manager_init() in main

    - swapped the advertising_init function from the blinky one to the HRS one and added the call to BLE_ADVERTISING_DEF.

    - initialized the DIS in services_init (don't know if this is necessary)

    - modified the custom service init routine to add permissions

    Alas, I'm now getting a crash when I attempt to connect to the device using the native Android mechanism. Another symptom is that the software crashes if I don't "Enable CCCD's" in nrf connect and try to run the custom service. Code embedded, please advise.

  • Would it be possible to have somebody take a look at this?

  • Hi,

    Can you try debugging your code and see what happens when you attempt to connect to the device through native Bluetooth? What do you mean by crash? Do you get any error codes?

  • Sorry, should have made that clear. on the phone side it starts pairing and then just quits. On the device side, it goes into the general fault handler (app_error_weak.c, the NRF_BREAKPOINT_COND trap).

Reply Children
  • I assume you are using SES as your IDE? if so, right click on your project in your left pane -> Press "Options..." -> Change the drop-down in the upper-left from "Debug" to "Common" -> Under Code, press "Preprocessor" -> Press the "..." in Preprocessor Definitions -> Then add "DEBUG" to the list.

    Then run your code in debug mode and see if you get any error codes in the debug consol and what function is returning it.

  • OK, I got the Nordic dongle to pair with the app by using the HRS example version of the ble_cus_init routine in the code shared earlier. The reason it was crashing was unrelated to the bluetooth aspects but rather that there was not enough memory allocated to the smartdevice, which became pretty clear when I enabled and looked at the RTT using the viewer. Fixing it involved altering the memory allocation in the linker section placement macros and changing NRF_SDH_BLE_VS_UUID_COUNT to 3 in sdk_config.h.

    Unfortunately the overall goal remains unfulfilled because the code doesn't run properly when I enable both the CLI and the bluetooth pairing. That's an entirely different topic so I'll open another ticket for that and close this one.