Resume advertising is not working

Hi,

I'm trying to connect multiple device on the same peripheral (nrf5340), but my peripheral does not restart advertising once a device is connected.

How to reproduce:

Use https://github.com/nrfconnect/sdk-nrf on branch v2.1-branch (f3b4453b08a7093e23670a7d15d3cccda6afda33).

Apply the following patch:

```diff --git a/samples/bluetooth/peripheral_gatt_dm/prj.conf b/samples/bluetooth/peripheral_gatt_dm/prj.conf
index a2ec483d3..ebbced361 100644
--- a/samples/bluetooth/peripheral_gatt_dm/prj.conf
+++ b/samples/bluetooth/peripheral_gatt_dm/prj.conf
@@ -19,3 +19,4 @@ CONFIG_BT_DEBUG_LOG=y
 CONFIG_BT_GATT_DM_DATA_PRINT=y
 
 CONFIG_DK_LIBRARY=y
+CONFIG_BT_MAX_CONN=10```

Build `bluetooth/peripheral_gatt_dm` sample.

Flash the board (nrf5340dk).

Expected behavior:

Once I connect a device on my board, the board should resume advertising and I should be able to connect a second device.

Actual behavior:

Once I connect a device on my board, the board DOES NOT resume advertising and I can't connect a second device.

Did I miss anything ?

Thanks

Parents
  • Hello ThomasW,

    I think there might be a misunderstanding here.

    I can't replicate your patch action, but from the log I assume the only change is adding CONFIG_BT_MAX_CONN=10 to proj.conf, right?
    This change only configures the sample setup to support 10 connections. It doesn't make the device advertise again. 

    Meanwhile, the sample you are working on, Peripheral GATT Device Manager (DM), is a sample designed to connect to one central, and therefore also doesn't have any code to advertise again.

    If you wish to see advertisement starts again, you could check out the Peripheral Bond Management Service (BMS) sample, which is designed to connect two central devices out of the box.

    If you wish to see the behavior in the Peripheral GATT DM sample, you need to write your own behavior. You could refer to the BMS sample for how to do so.

    Out of curiosity, where did you find the instruction to patch the sample like you did?

    Best regards,

    Hieu

    Edit: The information provided above regarding advertisement auto restart is incorrect and therefore I have editted it into strikethrough format.

  • Hi,

    I tried the `bluetooth/peripheral_bms` sample but once I connect to it (using my phone), it does not start advertising again.

    FYI, it's my own instruction:

    If I'm not mistaken, once a device is connected, bt_le_adv_resume will be automatically called by bt_hci_le_enh_conn_complete. But maybe setting CONFIG_BT_MAX_CONN > 1 is not enough. Maybe you can help me with that ?

    I tried the `bluetooth/peripheral` sample on Zephyr (v3.2.0) with the same patch and advertising restarts again after a connection.

    Do you know where the problem comes from ?

    Thanks

  • Hi,

    You can find enclosed the desired files.

    Since I use the sample, I don't change anything from the sample (except changing BT_MAX_CONN to 10 but I have the same behaviour if I don't change it)

    0044.peripheral_bms.zip0458.Kconfig.zip

    Let me know if you need anything else.

    Thanks for the support.

  • Hi ThomasW,

    Just want to let you know that today I have reproduced your observation on my nRF5340 DK, both with your files and with simply changing CONFIG_BT_MAX_CONN to something >1.
    I would like to believe I didn't see this last week, but it is not like I recorded a video or anything... On the bright side, we are now on the same page and that is better.

    It is worth noting that the LED which indicate that the nRF5340 is advertising is indeed blinking, just no advertisement comes out. Do you see the same behavior on your end?

    By the way, with the same project files I don't see the problem on the nRF52 DK.

    That's all I have for today. But given what I have seen so far, I am afraid I won't be back with an answer tomorrow, or even not in two days. If that is a problem, please let me know.

    Best regards,

    Hieu

  • Hi,

    I don't have a board to check the LED, sorry.

    The matter is pretty urgent, I was hoping to have an answer before the end of next week, but I'll try to find a workaround if it's not possible. Can you let me know please ?

    Thanks.

  • Hi ThomasW,

    I think I found the problem.

    In the nRF5340, you also need to configure the NetCore. Therefore, you need to create/update <Project Root>/child_image/hci_rpmsg.conf as followed:

    CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=<Your maximum number of connections as peripheral>

    Remember to perform a pristine build so that the build system picks up your new .conf file.

    Regarding the LED, please forget about it. Even though the documentation says it blinks while the device is advertising, it just blinks forever.
    I will have to check with SDK/documentation teams, but that is irrelevant to our discussion here.

    Best regard,

    Hieu

  • Hi,

    Thanks for this answer, I'll try it and check it's working.

    Using this sample, I was able to reproduce an issue I have with the firmware provided by the audio samples, so it's not in the real condition.

    Giving your answer and the fact that I don't have the source code for the binary provided for the audio application (https://github.com/nrfconnect/sdk-nrf/blob/v2.1.0/applications/nrf5340_audio/bin/ble5-ctr-rpmsg_3303.hex), can you check the value of "CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT" for this firmware ?

    Thank you.

Reply Children
Related