Max payload size of adv_data with extended advertizement

Hello,

I need your help about the BLE stack in zephyr with the NRF5340 chip.

For my project I need to use extended advertising in LE Coded PHY mode. I use the advertising type MANUFACTURER_SPECIFIC_DATA to advertise.

My problem is, when I want to send 255 bytes of adv_data, the BLE stack in zephyr doesn't allow me to do it. I'm limited to 191 Bytes but the Bluetooth specification allow 255 Bytes of PDU payload.

I configure CONFIG_BT_CTLR_ADV_DATA_LEN_MAX to the maximum authorized (191 Bytes).

Can you help me ? I try to configure others configuration, like increase the buffer size, but no impact .
Can we configure more advertising data than 191 Bytes ?

Thanks in advance.

Julien

Parents
  • Which Controller are you using Zephyr or Softdevice Controller? You can check in the .config file certain config settings as mentioned in this thread

    Which SDK version are you using? 

    I think Zephyr Controller has some limitation on the max adv data length you can use, I think it is less than 255 bytes (not 100% sure)

    If you are using Zephyr controller, try switching to softdevice controller and see if that helps.

    If not, then you can split up your adv data into two chunks and transfer them one after the another like below

    uint8_t adv_data1[191] = { /* First 191 bytes of data */ };
    uint8_t adv_data2[64] = { /* Remaining 64 bytes of data */ };
    
    struct bt_data ad[] = {
        BT_DATA(BT_DATA_MANUFACTURER_DATA, adv_data1, sizeof(adv_data1)),
        BT_DATA(BT_DATA_MANUFACTURER_DATA, adv_data2, sizeof(adv_data2))
    };
    
    err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);
    if (err) {
        printk("Failed to set extended advertising data (err %d)\n", err);
        return;
    }

    I have not tested this code, so please use it as reference only.

    Also make sure that the softdevice controller have buffers allocated to max to support larger PDU by setting these few in your prj.conf

    CONFIG_BT_BUF_ADV_DATA_SIZE=255
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_EVT_RX_SIZE=255
    CONFIG_BT_BUF_EVT_RX_COUNT=10

  • Hello,

    Thanks for your answer.

    I use zephyr controller in Zephyr 3.7.
    The cpunet of NRF5340 use the samples/bluetooth/hci_ipc project and the nrf5340_cpunet_iso-bt_ll_sw_split.conf 

    When I split my adv_data, I have the same error : "<wrn> bt_adv: adv or scan rsp data too large (238 > max 191)"

    The buffers size if allocated to max (255) in my prj.conf of hci_ipc project.

    It's probably  a limitation of Zephyr BT_LL_SW_SPLIT... but I can try in the new workspace with Noridc SDK for use the SoftDevice controller.

    Thanks.

  • try with SDC (Softdevice controller) and see if it helps. I can see many samples using SDC with ADV_DATA length longer than that, so I am hoping it should work. If it does not work with SDC aswell, then we can try to investigate that.

Reply Children
Related