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

How to adverting a single one packet and then timeout with latest softdevice s140 6.1.0

Hi support team,

I'm using sdk 15.0 and softdevice s140_nrf52_6.1.0 and nrf52840.

My application has strict requirements on power consumption, so I have to set advertising interval to larger than 10.24 seconds which is the maximum value of BLE SPEC.

  • I used an app timer to achieve that and it worked as expected.

Additionally, I want to make advertising only be able to send a single one packet and then timeout when I call adv_start method:

  • I used a short adv duration (timeout) which is less than adv interval(e.g. adv interval = 2s, timeout = 1s) to achieve that, it worked as expected with sdk 15.0 and softdevice 6.0.0.

However, after I upgraded softdevice from 6.0.0 to 6.1.0, the behavior of advertising module became weird. Actually, it seemed like the advertising didn't work at all. It was very difficult for my central devices to scan and connect to the peripheral with softdevice 6.1.0. I traced every adv packet in my central device, I only got 3 packets in 5 minutes, but I expected to receive about 25 packets.

Then I checked the release note of softdevice 6.1.0, I found a change in it:

Using a too short duration for the advertising event when advertising is no longer accepted by the API (DRGN-10067).

I wonder what is the duration for the advertising event, does it mean the adv duration or timeout?

If it is, what does too short mean? less than adv interval is too short? 

My problems are:

1. Could someone help verify that whether set adv duration to less than adv interval was supported in softdevice 6.1.0 or not?

2. If not, how can I achieve only advertising a single one packet and then timeout without using ble_radio_notification?

I don't want to involve the ble_radio_notification module unless I have to.

 

Best Regards,

Tengfei.

  • Hi,

    The longest allowed interval by BLE spec is 10.24 seconds. If you only allow one advertisement channel every 10.24sec by controlling the advertisement mask (ble_gap_ch_mask_t) in adv_params when calling sd_ble_gap_adv_set_configure(), then the average current consumption is very close to the System ON idle current. So not sure how much you will gain by reducing the interval even further. Once you get around ~2uA the life time of even a coin cell battery is  more than 10 years. 

    But to answer your question: I expect in this case that you will need to use radio notification to have full control of when it's advertising, and thereby you can from the application start and stop advertising as you see fit from an app_timer. The advertisement interval can be set to 10.24sec and duration to for instance 1 second if you only want to advertise 1 time. From the description of duration field in ble_gap_adv_params_t:

    uint16_t duration; /**< Advertising duration in 10 ms units. When timeout is reached, an event of type @ref BLE_GAP_EVT_ADV_SET_TERMINATED is raised.
    @sa BLE_GAP_ADV_TIMEOUT_VALUES. @note The SoftDevice will always complete at least one advertising event even if the duration is set too low. */

    Best regards,
    Kenneth

  • @sa BLE_GAP_ADV_TIMEOUT_VALUES. @note The SoftDevice will always complete at least one advertising event even if the duration is set too low. */

    Hi, I believe that softdevice will immediately send a packet after calling advertising start and wait for an interval to send another one if no timeout reached. This worked well in my application with softdevice s140_6.0.0, I set adv interval to 3s and timeout to 1s, my application only advertise one time and then timeout. However, after I upgrade softdevice to 6.1.0, the advertising did not work at all with the same code and config for advertising module. I could even not be able to discover it. Could you help to verify the issue for the new softdevice 6.1.0?

  • Can you first try this for instance using nRF5 SDKv15.2 and S132v6.1? For instance use hrs or beacon example? If you are not able to make that work I can give it a try here.

    Best regards,
    Kenneth

  • Hi Kenneth,

    Good news! I've found a pretty better way to achieve my requirement of advertising one time, by setting 

    max_adv_evts to 1 in ble_gap_adv_params_t before calling sd_ble_gap_adv_set_configure.
    By the way, I found a different behavior between softdevice s140 6.0.0 and 6.1.0. When I set adv duration less than the adv interval, for softdevice 6.0.0, it works well and I could receive both adv packet and the scan response. However, for softdevice 6.1.0, I could only receive adv packet but not be able to receive any scan response. This was actually the reason why I could hardly connect to the peripheral with softdevice 6.1.0 before.
    Could you please let me know if it was expected or a potential issue?
    Thanks,
    Tengfei.
  • Liu Tengfei said:
    Could you please let me know if it was expected or a potential issue?

    In the 6.1.0 release notes there is an entry: "Fixed an issue where the advertiser could send advertising packets beyond the set advertising duration (DRGN-10069). "

    I guess this is the root cause of what you are seeing

Related