← index #13639Issue #8264
Duplicate · high · value 1.376
QUERY · ISSUE

STM32: BLE Bonding Example does not work

openby hoihuopened 2024-02-11updated 2025-03-03
bugport-stm32

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!

CANDIDATE · ISSUE

example->bluetooth->ble_bonding_peripheral.py error with PYBD-SF2 and PYBD_SF6

closedby dmazzellaopened 2022-02-05updated 2022-02-10

Hi,
i have tried example/bluetooth/ble_bonding_peripheral.py with PYBD-SF2 and PYBD_SF6 and this is the error I have.

MicroPython v1.18-99-g203ec8ca7-dirty on 2022-02-05; PYBD-SF2W with STM32F722IEK
Type "help()" for more information.
>>> from ble_bonding_peripheral import demo
>>> demo()
no secrets available
get secret: 2 0 None
get secret: 10 0 b'irk'
set secret: (10, b'irk') b'\xd1\xd1\x03d\x8434\x1c\xb5\xa0\x9f\xc3*C\x81\xec'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/flash/lib/ble_bonding_peripheral.py", line 179, in demo
  File "/flash/lib/ble_bonding_peripheral.py", line 76, in __init__
  File "/flash/lib/ble_bonding_peripheral.py", line 153, in _advertise
OSError: -513
MicroPython v1.18-99-g203ec8ca7-dirty on 2022-02-05; PYBD-SF6W with STM32F767IIK
Type "help()" for more information.
>>> from ble_bonding_peripheral import demo
>>> demo()
no secrets available
get secret: 2 0 None
get secret: 10 0 b'irk'
set secret: (10, b'irk') b'M\x9e\x9f\x02\xce\xed\r\x18.E,\x85g\xe5\xd0\xd9'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/flash/lib/ble_bonding_peripheral.py", line 179, in demo
  File "/flash/lib/ble_bonding_peripheral.py", line 76, in __init__
  File "/flash/lib/ble_bonding_peripheral.py", line 153, in _advertise
OSError: -513
>>> 

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