Hello Everyone,
I would like to implement a random delay of 10 to 3000ms before my development kit start advertising itself.
I'm using nRF5dk v17.1.0.
How do i go about this?
Regards,
Zachary
Hello Everyone,
I would like to implement a random delay of 10 to 3000ms before my development kit start advertising itself.
I'm using nRF5dk v17.1.0.
How do i go about this?
Regards,
Zachary
Hello Zachary,
The random delay between advertisements are implemented in the softdevice and it is auto generated by random number generator. The value is always in between 0 and 10 ms.
Best Regards,
Kazi Afroza Sultana
Hi Kazi,
Thank you for your reply. I was looking for a random delay before my development kit starts the event of advertising or scanning.
I have attached an image of what I would like to implement.
Regards,
Zachary
Hello Lim,
I have found a similar case for nRF SDK v17.1.0. random delay - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com). It may help you.
Best Regards,
Kazi Afroza Sultana
Hello Lim,
I have found a similar case for nRF SDK v17.1.0. random delay - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com). It may help you.
Best Regards,
Kazi Afroza Sultana
Hi Kazi,
thanks for sharing the link.
I've tried placing the code within 1. timer_init() and setting up a new timeout_handler, 2. within advertising_init(). 3. placing it in the main_init() However, in these cases, no delay happened.
I'm actually not very sure where should I placed the one-shot pesudo code. Could you kindly direct me to the location that I need to place it in.
really appreciate your time for helping me out!
regards,
Zachary
Hello Zachary,
A delay is needed to be set up and started. You need to set how long the app_timer instance should be delayed until it executes. Could you please tell why you need to enable such feature? In which application you are trying to do this?
Thanks.
Best Regards,
Kazi Afroza Sultana
Hi Kazi,
Apologies for the late reply. I need this feature to prevent two devices to advertising at the same time.
I would like to place the random delay of 0 to 3 seconds at the start so that once the device is powered up, it will there will be a delay buffer before it initial to advertise or other event such as reading adc or scan.
Regards,
Zachary
Hello Zachary,
You need to set how long the app_timer instance should be delayed until it executes. So a while loop like this will be there-
while(wait_for_this_variable)
the formula of delayed app inside the nrf_delay_ms () function cna be implemented like this:
nrf_delay_ms((random_16_bit_number + 10) % 3000)
Try to implement this in your code.
Best Regards,
Kazi Afroza Sultana