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

Failed to connect to peripheral <my mac address>, addr type: random #495

Open
saeidfallah1132 opened this issue Oct 5, 2022 · 4 comments

Comments

@saeidfallah1132
Copy link

Hi,
I am using a python script that is running on Raspberry Pi4 as a scanner and NRF52840-DONGLE as a peripheral.
I am not able to connect to the peripheral, I got this error :
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral EF:9C:18:21:C7:9C, addr type: random

Could you please help me to fix the issue?

@dieser-niko
Copy link

Not an expert but have you tried to use public address type?
peripheral = btle.Peripheral(mac_addr, addrType=btle.ADDR_TYPE_PUBLIC

Also if possible, could you share a code snippet?

@doug-holtsinger
Copy link

doug-holtsinger commented Oct 24, 2022

I have code that works with a Pi3B as the Scanner and the nRF52840 Dongle as the Peripheral.
Scanner Connect: https://github.com/doug-holtsinger/WirelessSensor/blob/master/Compute/src/AHRS-VISUAL/ahrs-console.py#L703
Peripheral: https://github.com/doug-holtsinger/WirelessSensor/blob/master/Sensor/src/BLE/ble_svcs.cpp#L771
I had to workaround a connect problem by limiting the MTU size on the nRF52840 to 23 bytes, otherwise it would not connect. The Pi3B was sending out garbled packets during the connect phase. Do you have a Bluetooth sniffer? It helps a lot for diagnosing connection issues.

@dheerajluffy
Copy link

having the same issue here with pi4 trying to connect to nrf51822 , found any solution?

@dieser-niko
Copy link

@dheerajluffy please provide a code snippet, maybe I can help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants