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 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.

  • Hi ThomasW,

    The CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT we talked about is to configure the SoftDevice Controller in normal BLE applications.

    The Audio application uses a different BLE Controller, the LE Audio Controller Subsystem, so the above configuration does not take effect.
    This controller, as included in the precompiled binary, unfortunately can only support as followed:
    - As central, connects to two peripherals
    - As peripheral, connects to one central

    Best regards,

    Hieu

  • Hi,

    The product I'm developing needs this feature (BLE Audio and multiple centrals connection on its GATT server). How can we solve this issue ?

    Thanks

  • Hi ThomasW,

    It seems that, at least as of NCS 2.1.1 multiple centrals and LE Audio is just not possible. 

    Could you please let us know your use case? While unlikely, perhaps we can recommend a workaround. If such sharing is sensitive, we could provide support in a private ticket.

    Best regards,

    Hieu

Reply Children
Related