Skip to content

Failed to connect: internal error #191

@CptanPanic

Description

@CptanPanic

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: <Address 6c:79:b8:bb:b1:ed>
connectable: True
flags: <AdvertisingFlags general_discovery le_only >
matches: <bound_method>
rssi: -69
scan_response: True
tx_power: None
complete_name: None
get_prefix_bytes: <bound_method>
data_dict: {2: b'\xf0\xff', 1: <AdvertisingFlags object at 0x3de0dd20>}
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions