Change 'Connection Advertising Period(time)' dynamically in nRF52840

Hello Nordic Team,

I am currently working with development of applications for custom boards utilizing the nRF Connect SDK v2.4.0, with a focus on the nRF52840 microcontroller.

For this current project, the client has requested the implementation of a feature wherein the Advertising Period of the nRF52840 device needs to be dynamically changed from a mobile application. To be specific, what he requires is: When device boot, it should advertise for 1 second and than the device should disappear for 60secs and the process continuous. This cycle is intended to optimize power consumption.

I came across the following resource: https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/

Based on the information provided, it seems that the referenced code snippet may address the requirements. However, can I have clarification from your end?.

static struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM(
	(BT_LE_ADV_OPT_CONNECTABLE |
	 BT_LE_ADV_OPT_USE_IDENTITY), /* Connectable advertising and use identity address */
	800, /* Min Advertising Interval 500ms (800*0.625ms) */
	801, /* Max Advertising Interval 500.625ms (801*0.625ms) */
	NULL); /* Set to NULL for undirected advertising */

Could you kindly confirm if the specified process (in bold) is feasible? If affirmative, could you provide guidance on the appropriate configuration for achieving the desired 'Advertising Period' settings?

Regards,

Anmol

Parents
  • Hi,

    the client has requested the implementation of a feature wherein the Advertising Period of the nRF52840 device needs to be dynamically changed from a mobile application.

    In order to change the advertising period from the mobile application, you need to create a connection between the phone and the advertiser, and implement a service (or use an existing Bluetooth service) to send the new period from the application to the nRF52840 device. The device can then use this new period to configure the advertising.

    When device boot, it should advertise for 1 second and than the device should disappear for 60secs and the process continuous.

    The advertiser can be started with a timeout, to stop advertising after the given time. You will need to use a timer to restart the advertising after the sleep interval. Set CONFIG_BT_LIM_ADV_TIMEOUT and add BT_LE_AD_LIMITED to the BT_DATA_FLAGS.

    Best regards,
    Jørgen

  • Hello Jørgen,

    Thanks for your helpful insights in navigating through the initial stages of the development process. 

    However, I have encountered an issue wherein the advertisement fails to restart after the timeout period. I have reviewed the code and configuration settings, but I have not been able to identify the root cause of the problem.

    K_TIMER_DEFINE(my_timer, my_timer_handler, NULL);

    I have used this function for setting the timers. Can you please suggest is this the right timer I am using or need to change for the same? 

    Can you suggest any example for same?

    Regards

    Anmol 

Reply
  • Hello Jørgen,

    Thanks for your helpful insights in navigating through the initial stages of the development process. 

    However, I have encountered an issue wherein the advertisement fails to restart after the timeout period. I have reviewed the code and configuration settings, but I have not been able to identify the root cause of the problem.

    K_TIMER_DEFINE(my_timer, my_timer_handler, NULL);

    I have used this function for setting the timers. Can you please suggest is this the right timer I am using or need to change for the same? 

    Can you suggest any example for same?

    Regards

    Anmol 

Children
No Data
Related