Issue with maximum size of ext adv data, CONFIG_BT_CTLR_ADV_DATA_LEN_MAX

Hi all,

I have an issue with achieving bigger sizes of ext adv data as 31 bytes.

My current BLE code is pretty much the same as the nrf_dm sample code:

https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/nrf_dm/src/main.c

I just want to add more data into the "sd[]" array / extended advertising data. But it seems the maximum size is 31 bytes. Although I set:

CONFIG_BT_EXT_ADV=y
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=192 

in my configuration. Following things I figured out:

The bitfield flag "BT_ADV_EXT_ADV" seems to not be set. Thus in adv.c, hci_set_adv_ext_complete() the total_data_len gets truncated to 31 bytes. The code will internally return that the advertising payload is too large. However when I force setting the flag, then the program will generate an error later on in bt_hci_cmd_send_sync with "W: opcode 0x2038 status 0x12" 

What is the correct way of increasing my advertising size?

Parents
  • Hi Mark, 
    Could you try to reproduce the code in one of our sample or provide a minimum sample that we can test here ? 

    You can take a look at the peripheral_hr_coded (you can modify so that it uses 1Mbps instead of CODED) to see how extended advertising is used. 

  • Hi Hung Bui,

    as mentioned It is reproducible on the nrf_dm example. I get this output from the device: (which is an nrf52833dk).

    *** Booting nRF Connect SDK v3.0.1-9eb5615da66b ***
    *** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
    Starting Distance Measurement sample
    I: SoftDevice Controller build revision: 
    I: 89 9a 50 8a 95 01 9c 58 |..P....X
    I: fc 39 d2 c1 10 04 ee 02 |.9......
    I: 64 ce 25 be             |d.%.    
    I: HW Platform: Nordic Semiconductor (0x0002)
    I: HW Variant: nRF52x (0x0002)
    I: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
    I: Identity: C4:74:F6:86:20:61 (random)
    I: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
    I: LMP: version 6.0 (0x0e) subver 0x10f3
    DM Bluetooth LE Synchronization initialization
    E: Too big advertising data
    Failed setting adv data (err -22)
    Failed to start advertising (err -22)
    Synchronisation init failed (err -22)
    
    

    This is my diff to the nrf_dm sample on ncs 3.0.1.

    git diff
    diff --git a/samples/bluetooth/nrf_dm/prj.conf b/samples/bluetooth/nrf_dm/prj.conf
    index 8b994dab81..24d3d51ede 100644
    --- a/samples/bluetooth/nrf_dm/prj.conf
    +++ b/samples/bluetooth/nrf_dm/prj.conf
    @@ -36,3 +36,6 @@ CONFIG_NCS_SAMPLES_DEFAULTS=y
     CONFIG_DK_LIBRARY=y
     
     CONFIG_DM_HIGH_PRECISION_CALC=y
    +
    +CONFIG_BT_EXT_ADV=y
    +CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=192
    diff --git a/samples/bluetooth/nrf_dm/src/main.c b/samples/bluetooth/nrf_dm/src/main.c
    index ccb650a8e9..c8ae88a3ec 100644
    --- a/samples/bluetooth/nrf_dm/src/main.c
    +++ b/samples/bluetooth/nrf_dm/src/main.c
    @@ -62,9 +62,12 @@ static const struct bt_data ad[] = {
            BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
     };
     
    +double posData[3] = {0, 1, 2};
     static const struct bt_data sd[] = {
            BT_DATA(BT_DATA_MANUFACTURER_DATA, (unsigned char *)&mfg_data, sizeof(mfg_data)),
            BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_DDFS_VAL),
    +       BT_DATA(BT_DATA_INDOOR_POS, posData, sizeof(posData))
    +
     };
     
     static struct bt_le_scan_param scan_param = {
    

Reply
  • Hi Hung Bui,

    as mentioned It is reproducible on the nrf_dm example. I get this output from the device: (which is an nrf52833dk).

    *** Booting nRF Connect SDK v3.0.1-9eb5615da66b ***
    *** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
    Starting Distance Measurement sample
    I: SoftDevice Controller build revision: 
    I: 89 9a 50 8a 95 01 9c 58 |..P....X
    I: fc 39 d2 c1 10 04 ee 02 |.9......
    I: 64 ce 25 be             |d.%.    
    I: HW Platform: Nordic Semiconductor (0x0002)
    I: HW Variant: nRF52x (0x0002)
    I: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
    I: Identity: C4:74:F6:86:20:61 (random)
    I: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
    I: LMP: version 6.0 (0x0e) subver 0x10f3
    DM Bluetooth LE Synchronization initialization
    E: Too big advertising data
    Failed setting adv data (err -22)
    Failed to start advertising (err -22)
    Synchronisation init failed (err -22)
    
    

    This is my diff to the nrf_dm sample on ncs 3.0.1.

    git diff
    diff --git a/samples/bluetooth/nrf_dm/prj.conf b/samples/bluetooth/nrf_dm/prj.conf
    index 8b994dab81..24d3d51ede 100644
    --- a/samples/bluetooth/nrf_dm/prj.conf
    +++ b/samples/bluetooth/nrf_dm/prj.conf
    @@ -36,3 +36,6 @@ CONFIG_NCS_SAMPLES_DEFAULTS=y
     CONFIG_DK_LIBRARY=y
     
     CONFIG_DM_HIGH_PRECISION_CALC=y
    +
    +CONFIG_BT_EXT_ADV=y
    +CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=192
    diff --git a/samples/bluetooth/nrf_dm/src/main.c b/samples/bluetooth/nrf_dm/src/main.c
    index ccb650a8e9..c8ae88a3ec 100644
    --- a/samples/bluetooth/nrf_dm/src/main.c
    +++ b/samples/bluetooth/nrf_dm/src/main.c
    @@ -62,9 +62,12 @@ static const struct bt_data ad[] = {
            BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
     };
     
    +double posData[3] = {0, 1, 2};
     static const struct bt_data sd[] = {
            BT_DATA(BT_DATA_MANUFACTURER_DATA, (unsigned char *)&mfg_data, sizeof(mfg_data)),
            BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_DDFS_VAL),
    +       BT_DATA(BT_DATA_INDOOR_POS, posData, sizeof(posData))
    +
     };
     
     static struct bt_le_scan_param scan_param = {
    

Children
No Data
Related