Skip to content

BLE.advertise() Failure Makes BLE Unusable Until Next Reset #378

Open
@AndrewDile

Description

@AndrewDile

I'm currently using an Arduino Opta to advertise some information through the manufacturer's data. Because of this, I need to stop and restart the advertisement of the device quite often. I have noticed that, depending on the sketch and maybe other factors, it works for a while, only to then throw a single advertise error, which is quickly followed by zero successful BLE.advertise() calls after that. This could be an issue with my code, but I can't get any error code other than it failed, and there is not a ton of documentation on possible causes.

The amount of time it takes to fail seems to be random, but after one failure, there is no successful BLE,advertise() call after that. It also seems to be unrelated to connecting to devices, though it may change the average time to first failure. Ending and restarting the BLE stack in the program itself is out of the question because of how long it takes, especially since I have many more characteristics that I removed for code readability in my sample below. I've already guaranteed that the advertisement data all fits within the allotted 31 bytes, and I can confirm so by using NRF Connect and my own BLE scanner app to make sure.

Code:

BLE Debug.txt

Output from Code:

15:49:39.161 -> BLE Initialized
15:50:15.483 -> Connected to Central [address]
15:50:22.783 -> Disconnected from Central
15:50:42.822 -> Failed to advertise, trying again next call
15:50:44.853 -> Failed to advertise, trying again next call
15:50:46.854 -> Failed to advertise, trying again next call
15:50:48.846 -> Failed to advertise, trying again next call

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions