adafruit / adafruit/Adafruit_CircuitPython_BLE

Failed to connect: internal error

Open
#191 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
138
Forks
58
PR merge metrics
No merged PRs in 30d

Description

This is on a ESP32-S3 Reverse TFT, connecting to a BLE device. I get "Failed to connect: internal error"

Output:
```
code.py output:
Scanning for BLE devices...
found target device!
address:


connectable: True
flags:
matches:
rssi: -69
scan_response: True
tx_power: None
complete_name: None
get_prefix_bytes:
data_dict: {2: b'\xf0\xff', 1: }
mutable: False
match_prefixes: ()
_prefix_bytes: b''
short_name: None
Stopped Scan
Error connecting to robot: Failed to connect: internal error

Code done running.
```

```
import time
import adafruit_ble
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService

target_address = '6c:79:b8:bb:b1:ed'
target_address_bytes = bytes(reversed([int(x, 16) for x in target_address.split(":")]))

print("Scanning for BLE devices...")
ble = adafruit_ble.BLERadio()
devices = ble.start_scan(timeout=1, extended=True, interval=.2)

for device in devices:
if device.address.address_bytes == target_address_bytes:
print("found target device!")
for attr in ['address', 'connectable', 'flags', 'matches', 'rssi', 'scan_response', 'tx_power', 'complete_name', 'get_prefix_bytes', 'data_dict', 'mutable', 'match_prefixes', '_prefix_bytes', 'short_name']:
print(f"{attr}: {getattr(device, attr)}")

try:
ble.stop_scan()
print("Stopped Scan")

robot_connection = ble.connect(device)

if robot_connection and robot_connection.connected:
print("Connected to robot")
uart_service = robot_connection[UARTService]
uart_service.write(0xfff2)
print("Sent message to robot")
except Exception as e:
print("Error connecting to robot:", e)
break
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with code.py on the ESP32-S3 Reverse TFT and reproduce the failure using the shown scan and ble.connect(device) sequence. Inspect the connection path for the reported "internal error" and verify that the example can connect to the target BLE device without producing that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.