Aci_gap_set_discoverable() returns Command Disallowed after long period of execution (100+ connections, wakeups and advertisements)
I've been experiencing an issue where sporadically the aci_gap_set_discoverable fails to start due to a command disallowed error (similiar to this) on the STM32WB50.
For context: the device goes into sleep mode and wakes-up 100+ times per day. In sleep mode the device advertises in low power mode (min: 546.25ms, max 760 ms). When woken it will advertise in fast mode (min: 20 ms, max 25ms). These parameters perform well.
Before going to sleep mode all active connections are disconnected and this is verified by checking all the link statuses using aci_hal_get_link_status. Once every so many days the device will run into an error that it can't start advertising even though all links appear to be non-active and the advertising parameters are correct.
What additional steps can I take to debug this problem?
FYI, the device is running STM32CubeWB 1.15.0