Pico-W OSError: [Errno 22] EINVAL bluetooth module
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
RP2040 / Pico-W
MicroPython version
MicroPython v1.23.0-preview.116.g0432f7320 on 2024-02-12; Raspberry Pi Pico W with RP2040
Reproduction
This fault occurs when setting up a Bluetooth LE peripheral on a Pico-W. Three services are defined and added to the server configuration using BLE.gatts_register_services(). I've attached a code module to demonstrate the problem
Expected behaviour
The expected return from BLE.gatts_register_services() should be similar to that returned on an Arduino RP2040 Nano Connect using MicroPython v1.22.1 on 2024-01-05. E.g
((21, 24, 26), (29, 32, 34, 37), (41, 44, 46, 49))
Writes to values using these handles work as expected.
Observed behaviour
The returned set of handles from BLE.gatts_register_services() contains duplicates e.g.
((9, 12, 14), (17, 20, 22, 25), (27, 28, 28, 28))
Writing a value to handle 17 works OK. Writing a value to handle 27 causes Error 22.
Additional Information
The ESP32 port appears OK too.
rp2: code sometimes hangs when doing `bluetooth.BLE().active(True)`
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
rp2 port with RPI_PICO_W
MicroPython version
RPI_PICO_W-20240105-v1.22.1.uf2
Reproduction
Run the application at https://github.com/Gaudon/zephyr-cycling:
- install
RPI_PICO_W-20240105-v1.22.1.uf2to a Pico W board - copy all files from the above repo to the board (omit
firmwaredirectory) - copy
config/template-primary.txtorconfig/template-secondary.txtto the board atconfig/config.txt(they can be changed to assign different GPIO if needed) - reset the board to run the code in
main.py
Expected behaviour
Application starts and continues to run.
Observed behaviour
Code sometimes hangs at ble.active(True).
Additional Information
This is branched off from issue #6423 at https://github.com/micropython/micropython/issues/6423#issuecomment-1995163998
Note that I cannot reproduce this issue, but @Gaudon can in the above thread.