Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pairing Started and Disconnected in Arduino Nano BLE Sense, But Why??? #241

Open
laviator98 opened this issue Jun 9, 2022 · 11 comments
Open
Labels
type: imperfection Perceived defect in any part of project

Comments

@laviator98
Copy link
Contributor

laviator98 commented Jun 9, 2022

Recently Arduino team also added this Lib in their Page as V 1.3.1 and 1.3.0 . I uploaded the Encrypted Battery Monitor Example in my Arduino Nano 33 BLE Sense nrf52840. First, the Numeric Comparison was done and 6 Digit Pin is passed to the mobile phone. By clicking Pair Button, it got disconnected. I also Checked the Scripts, am i missing something?? . Kindly someone help me here. Does Arduino BLE Sense Supports Pairing Process???

Also Adafruit BLE lib (BlueFruit52) also Contains Pairing Examples.
https:/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/pairing_passkey

But Why Arduino is lagging to give a pairing Example but Adafruit already gave Pairing Examples in their Lib.

@laviator98 laviator98 changed the title Pairing Started and Disconnected in Arduino BLE Sense, But Why??? Pairing Started and Disconnected in Arduino Nano BLE Sense, But Why??? Jun 9, 2022
@per1234
Copy link
Contributor

per1234 commented Jun 27, 2022

Why Arduino is lagging to give a pairing Example

As you are already aware, a pairing example was added at the same time as the pairing support (#156).

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Jun 27, 2022
@laviator98
Copy link
Contributor Author

laviator98 commented Jun 27, 2022

As you are already aware, a pairing example was added at the same time as the pairing support (#156).

@per1234 Are You Mentioning the Encrypted Battery Monitor Example? It is not working Bro. I think the code is not completed correctly. I am Using android phone for pairing and it is showing the error as "Pass Key or PIN is incorrectly Entered". Also I can't find the Pass Key Submission in this Lib.

Also In Adafruit Bluefruit52 Lib, they used nrf52, S140 API for the Pairing and Encryption.
https:/adafruit/Adafruit_nRF52_Arduino/tree/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include

I don't know why for Arduino this S140 API is not used?

I think this is the proper solution for the Paring and Encryption. I'm Also Working on it. Kindly please everyone work on it.

BLE_Error

@maahinberiLW
Copy link

Yeah, I have the same issue. I've tried it with all different types of scanner apps and even tried my own custom app on iOS. I cannot get it to display the MAC and Key of the device that's trying to pair

@mklemarczyk
Copy link
Contributor

I remember that there were two pairing methods used in the past. One with hidden key and one with open key. In the first one the key had to be communicated to the host by other means, like screen or Serial and entered on the host device. The second one was just to confirm the pairing key is the same as in pairing device and it was displayed to the user to confirm that this is device that you are connecting to.

In any way I believe that you should be able to get your pairing key from the Arduino by just printing it to console or display on the 8 digit display.

@Jesse-AH-Carpenter
Copy link

I've been running into a same problem. When using the EncryptedBatteryMonitor example, it displays the mac address of the device that is attempted to pair with the Arduino device, but fails to create a key, and proceeds to disconnect from the device. I've tried all of the scanner apps they recommend and none of them work.

@laviator98
Copy link
Contributor Author

As I go through the scripts of ArduinoBLE V 1.3.1 and Adafruit Bluefruit52 Libs, it shows that Arduino BLE uses this docs for connection and pairing mode:
https://www.bluetooth.com/specifications/specs/core-specification-4-2/
https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=441541

Adafruit uses this API from nrf site for pairing for only a certain APP of Adafruit or nrf Connect:
https://www.nordicsemi.com/Products/Development-software/S140/Download?lang=en#infotabs

@laviator98
Copy link
Contributor Author

laviator98 commented Jul 8, 2022

In the ArduinoBLE library, by uncommenting #define _BLE_TRACE_ in scripts L2CAPSignaling.cpp, HCI.cpp, ATT.cpp we will get internal data for communication.

All Stages for pairing is done but it is not working,
Kindly someone help me here.

BLE OUT.txt

@alexpopof
Copy link

I am seeing similar behavior. For what it's worth, I recall testing around October 2021 when I saw activity in #156 (@unknownconstant). Things worked well and it was also tested by @alranel who said it worked as well. I wonder if there was a breaking change in the meantime, especially given how long it took for the pull request to get merged.

@mklemarczyk
Copy link
Contributor

If testing is required. I can perform with various devices (Arduino Nano BLE, Nano IoT, Nano Connect).
I can test with Windows 10 and Linux hosted on Raspberry Pi 3 and Pi 4.

@bringert
Copy link

I'm seeing this too. On an Arduino Nano 33 BLE, bonding with the EncryptedBatteryMonitor from nRF Connect on Android fails with "incorrect PIN or passkey". The exact same code running on an Arduino Nano 33 IOT can bond fine.

@vadimkhm
Copy link

I wonder if someone can figure out this, I have the same problem but with Arduino Uno R4 Wifi.

In my case, BLE is connected to Windows if I call this BLE.setPairable(0);.
So it works only for Windows, for Android phones BLE.setPairable(1); should be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

8 participants