Skip to content

Maxlen of Bluetooth name? Too long names result in a crash during start_advertising #5043

Open
@ThomasAtBBTF

Description

@ThomasAtBBTF

CircuitPython version

Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Adafruit ItsyBitsy nRF52840 Express with nRF52840

Code/REPL

# boot.py
usb_cdc.enable(console=True, data=False)
usb_midi.disable()

#code.py
...

devicename = "123456789A123456789B123457"
# this are 27 characters (no error in advertisement with names which are 26 characters long)

...

_bleio.adapter.name = devicename  # I don't know if the device name here or bleow is neccessary!
ble = adafruit_ble.BLERadio()
ble.name = devicename # I don't know if the device name here or above is necessary!
...
    print("Start advertizing:", self.service)
...
if self.isconnected:
  ...
else:
  print("unconnected", self.ble, self.ble.name, self.ble.connections)
...

...
ble.start_advertising(self.advertisement)
# In that call the Error below is thrown.

Repl:
unconnected <BLERadio object at 2001c8a0> 123456789A123456789B1234567 ()
Start advertizing: HID
Traceback (most recent call last):
  File "code.py", line 336, in <module>
  File "code.py", line 174, in check
  File "/lib/adafruit_ble/__init__.py", line 195, in start_advertising
ValueError: Invalid BLE parameter

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

The next reload will often crash the board (the serial port over USB is disconnected)
And only reset(I think) or removing and reapplying USB-Power reboots the board.

Behavior

When I use device names with 27 characters or more a Runtime Error is thrown during Advertisement.
Screenshot_20210723095314

In this picture, you see a crash with devicename 30 characters long.,

Description

Error when allowing user-specific DeviceNames.
(I will limit them to 26 Characters in the code)user-specific

Additional information

During narrowing down this issue I found another strange bug which I will file later.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions