STM32: BLE Bonding Example does not work
I'm using a Pyboad SF2 and nightly build as of
MicroPython v1.23.0-preview.90.ged15b3c6c on 2024-02-06; PYBD-SF2W with STM32F722IEK
When trying the bonding example:
https://github.com/micropython/micropython/blob/master/examples/bluetooth/ble_bonding_peripheral.py
I got the following response:
no secrets available
get secret: 2 0 None
get secret: 10 0 b'irk'
set secret: (10, b'irk') b'\xdc$W\xae\xf1I\xb9\xee\xc0\x9f\xc7\xed,\x82\t\x94'
Traceback (most recent call last):
File "<stdin>", line 199, in <module>
File "<stdin>", line 184, in demo
File "<stdin>", line 81, in __init__
File "<stdin>", line 158, in _advertise
OSError: -513
the problem seems to be related to the ble.config's addr_mode. If I uncomment the call here:
https://github.com/micropython/micropython/blob/master/examples/bluetooth/ble_bonding_peripheral.py#L75
and here:
https://github.com/micropython/micropython/blob/master/examples/bluetooth/ble_bonding_peripheral.py#L157
it doesn't throw the error.
I understand that the ble bonding is still a work in progress demo. However I wanted to have a go on implementing bonding support for the pico_w. , and for this I thought I'd first start with a working example from a supported platform (even if it's from nimble - so another ble stack than on the pico_w).
Also.. is addr_mode set to 2 required for ble bonding?
Thanks for hints and clarifications!
extmod/modbluetooth: Add pairing/bonding support (v2)
This builds on #6651 . Changes to that PR are:
- rebase on latest master (to get new CI to run)
- fix build on esp32
- minor updates to docs
- fix bug in example with
i += 1 - added basic multitests for pairing and for pairing+bonding