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

Change of ADV data in SDK 17

Hello 

We have an application that ADV every second and is based on SDK 14.

We are currently attempting to move to SDK 17. What I have noticed is that if I change and ADV data during advertisement by the help of new API function ble_advertising_advdata_update I see that there will be a delay of ±2 seconds (I see it in air trace) during which there will be no ADV at all.

Even when I configured ADV interval to be 100 milli and data rate change is 1 time at a second I see a delay of 2 seconds over the air until an updated data takes place.

The question is: Is that an expected behaviour? Is there any way to prevent this stop of ADV for 2 seconds?

Parents
  • Hello,

    We are currently attempting to move to SDK 17. What I have noticed is that if I change and ADV data during advertisement by the help of new API function ble_advertising_advdata_update I see that there will be a delay of ±2 seconds (I see it in air trace) during which there will be no ADV at all.

    This does sound strange. Is your call to ble_advertising_advdata_update returning any error codes at any point?
    The updating of advertising data can be done between every advertisement, and should take effect before the next advertising, or at worst before the second advertising.

    Even when I configured ADV interval to be 100 milli and data rate change is 1 time at a second I see a delay of 2 seconds over the air until an updated data takes place.

    How are you queueing the updating of the data, through a timer?

    Could you make sure that you have DEBUG defined in your preprocessor defines, like shown in the included image?

    1 - 2 seconds sounds like you application might be encountering an error and / or resetting. Could you verify if this occurs, that the device resets in this timespan?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • Hello Karl

    I ma not hitting app_error_handler and do run with DEBUG (turned it on)

    The error code returned by the function ble_advertising_advdata_update is NRF_SUCCESS

    However I do see in the over the air behaviour a delay

    The timer is our internally implemented timer which expires every second and from the timer I call to the function 

    ble_advertising_advdata_update(&m_advertising, &advdata, NULL); (We do not need any scan response data)

    I override simply a data in the ble_advertising_init_t with the new one and call to the ble_advertising_advdata_update

    (To my understanding this shall be ok since soft device copies ADV data into internal buffer)

    Am I wrong?

  • Ok

    I got to the root cause of the problem.

    I hit HardFault handler in the function sd_ble_gap_adv_set_configure

    If I call the function from our main loop - I do not hit any breakpoint and everything works smoothly.

    However when I use our regular flow:

    I hit an error. Is there any restriction or when the sd_ble_gap_adv_set_configure is called or context of the caller?

  • I just wanted to state it more clear - if the function BLE_update_advertise is being called at the context of main loop - no problem

  • One more question: by logger you mean rtt viewer right?

  • And one more observation is that when I disabled usage of man specific data at all and just call for the update of ADV data with the same parameters that I initialised at the beginning I still crash - which may be points to the direction of contexts...

  • Hello,

    KTM said:

    I got to the root cause of the problem.

    I hit HardFault handler in the function sd_ble_gap_adv_set_configure

    If I call the function from our main loop - I do not hit any breakpoint and everything works smoothly.

    Great observation, thank you for clarifying! 

    KTM said:
    I hit an error. Is there any restriction or when the sd_ble_gap_adv_set_configure is called or context of the caller?

    Nothing beyond what is written in the sd_ble_gap_adv_set_configure documentation

    KTM said:
    One more question: by logger you mean rtt viewer right?

    That depends - have you configured the logger module to use the RTT backend?
    In that case, yes, I do mean RTT viewer or the Debug Terminal in SES ( please not that you need to define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0 for Debug Terminal to work ).
    Are you seeing any output on your RTT Viewer at all, when your program is running?
    While you may continue debugging as you currently are, I would highly recommend making use of the logger module, since this will drastically ease debugging.
    If you are not seeing any logger outputs, then we should solve that problem before continuing the advdata_update issue - since having a logger working will make all future debugging easier.

    KTM said:
    And one more observation is that when I disabled usage of man specific data at all and just call for the update of ADV data with the same parameters that I initialised at the beginning I still crash - which may be points to the direction of contexts...

    Yes, I too would say this points in the direction of the context.
    What context is the advdata update function called from in your regular program? Could you change the priority of the interrupt that triggers the update, to see if this affects your issue?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Reply
  • Hello,

    KTM said:

    I got to the root cause of the problem.

    I hit HardFault handler in the function sd_ble_gap_adv_set_configure

    If I call the function from our main loop - I do not hit any breakpoint and everything works smoothly.

    Great observation, thank you for clarifying! 

    KTM said:
    I hit an error. Is there any restriction or when the sd_ble_gap_adv_set_configure is called or context of the caller?

    Nothing beyond what is written in the sd_ble_gap_adv_set_configure documentation

    KTM said:
    One more question: by logger you mean rtt viewer right?

    That depends - have you configured the logger module to use the RTT backend?
    In that case, yes, I do mean RTT viewer or the Debug Terminal in SES ( please not that you need to define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0 for Debug Terminal to work ).
    Are you seeing any output on your RTT Viewer at all, when your program is running?
    While you may continue debugging as you currently are, I would highly recommend making use of the logger module, since this will drastically ease debugging.
    If you are not seeing any logger outputs, then we should solve that problem before continuing the advdata_update issue - since having a logger working will make all future debugging easier.

    KTM said:
    And one more observation is that when I disabled usage of man specific data at all and just call for the update of ADV data with the same parameters that I initialised at the beginning I still crash - which may be points to the direction of contexts...

    Yes, I too would say this points in the direction of the context.
    What context is the advdata update function called from in your regular program? Could you change the priority of the interrupt that triggers the update, to see if this affects your issue?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Children
No Data
Related