This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Update data of extended advertisement (BLE5)

Hello

I would like to use the extended advertisement feature of BLE 5 and sometimes update the data.

My code works but there is one of your functions which returns me an error code which disturbs a little.
When I call the "ble_advertising_advdata_update(...)" function, there is function "sd_ble_gap_adv_set_configure(...)" which returns error 9 (NRF_ERROR_INVALID_LENGTH).

I notice that if adv_data is smaller than 32 bytes, I have no error but if it is larger then I have error 9 ...

However I use the "extended" functionality so I should be able to exceed 31 bytes of adv_data right?



  • Hi

    The initial advertisement packet won't be able to exceed 31 bytes, you'll have to offload the rest of the advertisement to the secondary channels. Please check out the S140 SoftDevice API for details on how to do this. Unfortunately, I don't think we have an example that does this already, so you'll have to add this part yourself I'm afraid.

    Best regards,

    Simon

  • Hi

    I thought that the SoftDevice automatically added the data on the secondary channel when using the extended advertisement: this is not true?

    If I have to specify that certain parts of my advertising packet must be in the secondary channels: do you have a function which makes it possible to do that? For exemple, is it possible to set "appearance" on the secondary channels ?

    Thank you

  • Hi Quentin

    You're absolutely right, the SoftDevice does take care of putting data into the secondary channels. I guess my explanation was rather lackluster in my previous reply, but it seems like you haven't enabled extended advertising properly. You can check out the Running speed and Cadence application for an example of how to enable extended advertising, and check out this blog post for a more detailed "walkthrough" of the extended advertising setup.

    Please also check out this case, which discusses extended advertising in detail.

    Best regards,

    Simon

  • Hi Simonr

    In my application, I used 2 different advertisements. I have a advertisement for BLE5 which countain more data (with extended advertising enabled) and advertise for 1 second. Next, it is a advertisement for BLE4 which advertise for 1 second.

    Everything seems to work but I get error 9 from "sd_ble_gap_adv_set_configure()" function which I don't understand why.
    The first time I call this function I have no problem (to configure the advertisement BLE4 for example) but after that, if I recall this function to configure the advertisement BLE5 (with new parameters) I have this error …

    Can you give me the conditions that can return this error?

    Thank you

  • Hi

    sd_ble_gap_adv_set_configure() only returns error 9 (NRF_ERROR_INVALID_LENGTH) if the advertising data length is invalid, so in your case, I assume the extended advertising parameter isn't "activated" upon recalling this function. I think you might have to uninitialize and reinitialize the advertising module altogether when going from BLE4 to BLE5 advertisements in order to ensure that extended advertising is initialized correctly.

    Best regards,

    Simon

Related