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:
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, Pi Pico W
MicroPython version
Hi,
This maybe a pico-sdk bug? But posting here since I'm building micropython for Pico W with double precision ...
Building v1.22.0-402-g03cf4d498-dirty, using ARM toolchain 13.2.Rel1-x86_64-arm-none-eabi
System specs are: Linux 6.1.67-gentoo-x86_64, AMD Ryzen 5 1600X, 32GiB RAM
Build fails at object linking stage.
Solution provided, but this might break something else downstream?
Reproduction
make -C mpy-cross
cd ports/rp2/
make BOARD=RPI_PICO_W submodules
make BOARD=RPI_PICO_W clean
make BOARD=RPI_PICO_W
Expected behaviour
Expect object linkage to complete successfully
Observed behaviour
In file included from /micropython/lib/pico-sdk/src/rp2_common/pico_platform/include/pico/platform.h:72,
from /micropython/lib/pico-sdk/src/common/pico_base/include/pico.h:33,
from /micropython/lib/pico-sdk/src/common/pico_binary_info/include/pico/binary_info/code.h:13,
from /micropython/lib/pico-sdk/src/common/pico_binary_info/include/pico/binary_info.h:28,
from /micropython/lib/pico-sdk/src/rp2_common/pico_standard_link/binary_info.c:8:
/micropython/ports/rp2/sys/cdefs.h:234: error: "__packed" redefined [-Werror]
234 | #define __packed attribute((packed))
|
In file included from /micropython/lib/pico-sdk/src/common/pico_binary_info/include/pico/binary_info.h:24:
/micropython/lib/pico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.h:21: note: this is the location of the previous definition
21 | #define __packed attribute((packed))
|
cc1: all warnings being treated as errors
make[3]: *** [CMakeFiles/firmware.dir/build.make:6871: CMakeFiles/firmware.dir/micropython/lib/pico-sdk/src/rp2_common/pico_standard_link/binary_info.c.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:1516: CMakeFiles/firmware.dir/all] Error 2
make[1]: *** [Makefile:91: all] Error 2
See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [Makefile:60: all] Error 1
Additional Information
Bug fixed with following patch on
micropython/lib/pico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.h
21c21
< #define __packed __attribute__((packed))
---
> #define __packed __attribute__((__packed__))