Hello..
I tried implementing a simple application using nRF Connect SDK, which sends data in a connection event using notifications. This is the base code for a test application which requires the peripheral to operate in the connectable (and non-scannable) undirected advertising mode. According to the BLE specs, this is only achievable using advertising extensions.
The connection gets established successfully and I am also able to see the notification data using nRF Connect App for Android. However, once the peripheral enters connection, it stops advertising, and does not re-start advertising even after getting disconnected. The only way it starts advertising again is resetting the peripheral. After a lot of struggle, this is the current status:
- Inside the connection disconnected callback function, I called the extended advertising start function, and this worked perfectly. Once the peripheral gets disconnected, it resumes extended advertising.
- However, this is not the desired behavior. I want the peripheral to keep advertising once it enters the connection mode so that it is also visible to other devices. I searched and came across the following GitHub link and few other links referenced in this discussion that pointed out the exactly same issue:
https://github.com/zephyrproject-rtos/zephyr/issues/33897
The suggested workaround in this discussion is to call the extended advertising start function inside the advertising connected callback (using the bt_le_ext_adv_cb callback struct) inside the bt_le_ext_adv_create() function. I tried doing this, exactly the same way as I called the extended advertising start function inside the disconnected callback function earlier.
But this does not seem to work. I keep on getting either the ENOMEM error (error -12), or the error log shown in the picture:
The same method works with the disconnected callback but fails with the advertising connected callback. Is there anything that I might have missed?
The proj.config file looks like this:
nRF52840 has been used as the peripheral. Could you please look into this once and suggest a suitable workaround?