Bluetooth Random address

8 posts / 0 new
Last post
dhirajp15
Offline
Last seen:2 years 1 month ago
Joined:2016-06-08 15:26
Bluetooth Random address

Hi Dialog,
I am using 583 module in extended sleep mode with external wakeup interrupt implemented using ble_barebone example which works fine and it advertises with following config:
/// Advertise operation type.
.advertise_operation=ADV_UNDIRECT,
/// Own BD address source of the device:
.address_src=GAPM_PUBLIC_ADDR,
/// Advertise interval
.intv = 64, // 50ms (80*0.625ms)

///Advertising channel map
.channel_map = 0x7,

我现在想要做广告用随机BLE地址es , so i did the following change:
.address_src=GAPM_GEN_STATIC_RND_ADDR,
So I am able to generate random addresses on each connection , but the device does'nt go to sleep , what other changes do I need to make it sleep and advertise with random address?

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

I dont see how the option of advertise with random addresses is related to the fact that the device is not going to sleep, something else is the problem. If you switch back and forth in that configuration can you see the device not sleeping and sleeping, and how exactly you check that the device is sleeping ? By smart snippets ? You measure the power consumption via a DMM? I dont see anything similar on my setup.

Thanks MT_dialog

dhirajp15
Offline
Last seen:2 years 1 month ago
Joined:2016-06-08 15:26
Hi MT_Dialog,

Hi MT_Dialog,
I have set a timer where inside it callback i have written
arch_ble_set_ext_sleep():
arch_ble_ext_wakeup_on():
This usually takes the proccessor to extended sleep till I press wakeup button, and the processor during sleep did not advertise if I use public address in user config, but on setting random address it kept on advertising even if the after the sleep instruction is called
Thanks,
Dhiraj

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

Something is missing from your description, as far as i understand you set the device in advertising mode and you are counting the advertising time via a kernel timer and when that timer elapses you invoke from the timer callback those two functions and the device stops advertising ? In order to stop advertising regardless the address that you are using (public or private, static or random), somewhere in the code you should stop advertising. If you dont send the GAPM_CANCEL_CMD command your device should go on advertising forever, by just invoking the arch_ble_ext_wakeup_on() isn't going to stop your device for advertising. The recommended scheme of doing this is to invoke a timer when advertising, and from the timer callback send a GAPM_CANCEL_CMD, when the advertising stops then you will invoke all the nessecary functions for the wake up procedure. So check where is that you stop advertising.

Thanks MT_dialog

dhirajp15
Offline
Last seen:2 years 1 month ago
Joined:2016-06-08 15:26
Hi MT_Dialog,

Hi MT_Dialog,
Thanks for the help!
I used app_easy_gap_advertise_stop() function before calling sleep and it works!
So in ble_barebone example 583 starts advertising by default , if i call app_easy_gap_advertise_stop() inside user_app_init() , it doesnt stop advertising what should i do to stop advertising at the start, my aim is to wakeup the device on external interrupt and make it advertise, I dont want it to advertise at the start
Thanks dhiraj

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

If you send a message from the app_init() the message will never get executed since after the app_init() the message queues of the kernel are getting reset (GAPM_RESET). What i dont understand is why you would like to cancel the advertising before it begins ? and why invoke advertising_stop when you can simply never start advertise ? If you dont want to advertise as soon as the device starts up you can create a custom function and replace either the default_app_on_set_dev_config_complete() or the default_app_on_db_init_complete() depending if you are creating a database on your device or not. For example the barebone starts advertising from default_app_on_db_init_complete() since it implements the diss service. If there is no service implementation when the configuration of the device ends the device will start advertising from the default_app_on_set_dev_config_complete().

Thanks MT_dialog

dhirajp15
Offline
Last seen:2 years 1 month ago
Joined:2016-06-08 15:26
Hi MT_dialog,

Hi MT_dialog,
I am able to implement random BLE addressses successfully.
Thanks for the help.
Regards,
dhiraj

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

Glad you could make it work, If any of the above posts have helped, please mark them as accepted.

Thanks MT_dialog