← index #803Issue #996
Related · high · value 1.358
QUERY · ISSUE

aioble 'BLE' object has no attribute 'l2cap_connect' on Pico-W

openby mcarlsonopened 2024-02-09updated 2024-02-15

I'm trying to run the l2cap_file_client.py and l2cap_file_server.py examples from https://github.com/micropython/micropython-lib/tree/master/micropython/bluetooth/aioble on my Pico-W. I'm currently running MicroPython v1.22.0-preview.236.ge1a7aa23f on 2023-12-09; Raspberry Pi Pico W with RP2040

It sounds like the BLE support for the Pico-W is missing l2cap functionality, I get stack traces like:

...
Connecting to Device(ADDR_PUBLIC, d8:3a:dd:94:88:0e)
Discovering...
Connecting channel
Task exception wasn't retrieved
future: <Task> coro= <generator object 'getPrefsFromServer' at 20012c60>
Traceback (most recent call last):
  File "asyncio/core.py", line 1, in run_until_complete
  File "l2cap_file_client.py", line 152, in getPrefsFromServer
  File "l2cap_file_client.py", line 62, in connect
  File "aioble/device.py", line 288, in l2cap_connect
  File "aioble/l2cap.py", line 205, in connect
AttributeError: 'BLE' object has no attribute 'l2cap_connect'

What can I do to get this working? More documentation about what is/isn't supported on a given platform would be really helpful as I just blew an afternoon getting to this point. Seems to be a bit of a theme, see https://github.com/micropython/micropython-lib/issues/444 and https://github.com/micropython/micropython-lib/issues/686

2 comments
andrewleech · 2024-02-14

Yes unfortunately l2cap support hasn't been added on btstack BLE integration yet which rp2 uses.

https://docs.micropython.org/en/latest/library/bluetooth.html#l2cap-connection-oriented-channels

Note: This is currently only supported when using the NimBLE stack on STM32 and Unix (not ESP32). Only one L2CAP channel may be active at a given time (i.e. you cannot connect while listening).

mcarlson · 2024-02-15

Okay, thank you!

CANDIDATE · ISSUE

aioble not happy with characteristic writes...

openby watercolukeopened 2025-04-08updated 2025-06-03

Howdy Legends,

Getting some weird errors when doing the most basic writes...

I am connecting just fine to an ESP32-S3 running Firmware: 3.4.0; MicroPython v1.24.1 on 2024-11-29., and aioble is the latest.

With capture=True on the characteristic, when I attempt a write from LightBlue I get:

Unhandled exception in IRQ callback handler
Traceback (most recent call last):
  File "/lib/aioble/core.py", line 71, in ble_irq
  File "/lib/aioble/server.py", line 48, in _server_irq
  File "/lib/aioble/server.py", line 184, in _remote_write
AttributeError: type object 'BaseCharacteristic' has no attribute '_capture_queue'

...and then with capture=False just not getting anything.

Anything obvious I am missing?

Best,
Luke

2 comments
watercoluke · 2025-06-03

Here is another clue, again just following the example way to receive a written event. On startup I'm getting:

Registering service...
assert lld.c 422, param 00000000 00000000
Service registered.

Anyone ever seen this assertion? I'm running a plain Espressif ESP32-S3-DevKitC-1 and latest MicroPython release, following the basic aioble examples. All pretty out of the box stuff, but getting errors :(

Josverl · 2025-06-03

May I suggest you change this into a discussion, and only raise an issue here when you are sure there is a bug ?
I think you will get more responses there.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied