Start advertising from a button interrupt

4 posts / 0 new
Last post
Joacimwe
Offline
Last seen:1 year 2 months ago
Guru
Joined:2014-01-14 06:45
Start advertising from a button interrupt

Hi. We are trying to modify the proximity_fh project to start the advertising when a key has been pressed. When the button is released, we want to stop advertising.

In the original sample code, advertising starts immediately. We turned automatic start of "app_adv_start()" off, and instead now we run "app_adv_start()" in the key interrupt handler if the key was pressed, and "app_adv_stop()" if the key was released. It doesn't seem to work.

However, there seem to be an event or interrupt of some kind happening every 10 or 12 seconds. Using the SmartSnippets tool, we see that the current level goes up to ~0.8mA for a short amount of time, and we have no idea what that is, but it seem to wake up the device from sleep mode and re-init most things, such as leds, and it also starts the advertising if we pressed the button right before (i.e. the advertising starts much later after we pressed the button).

The same thing happens if we start from the proximity_fh sample and only change the advertising interval to more than 12 seconds, then no advertising seem to occur anymore and instead that 0.8mA current increase occurs every 10 or 12 seconds.

First, what is this interrupt happening when the device is in extended sleep but not while advertising?
Second, how would we approach getting advertising to work when holding down the button?

We have checked the keyboard example but we think it isn't exactly what we're looking for.

Joacimwe
Offline
Last seen:1 year 2 months ago
Guru
Joined:2014-01-14 06:45
So, just to clarify the

So, just to clarify the question in case it was not clear:

If we somewhere in our project call the app_adv_stop() function, then the advertising will stop and the chip goes into sleep mode. The issue is that from this point on there will be a timer event starting every 10-12 seconds. Please let me know what this is and why it happens.

Thanks

Kim
Offline
Last seen:6 years 7 months ago
Joined:2014-03-14 14:55
Maybe it is because you're in

也许是因为你在app_ble_ext_wakeup_off - mode?
UM-B-006, p12:
Restore BLE cores' operation to default mode. In this mode, the BLE core
will wake up every 10sec even if no BLE events are scheduled. If an event has been
scheduled earlier, then the BLE core will wake up sooner to serve it.

I don't know if this is what you're looking for, but we have noticed the same thing.

WT_Dialog
Offline
Last seen:3 years 1 month ago
Staff
Joined:2013-12-05 14:43
Hi Kim and Joacimwe,

Hi Kim and Joacimwe,
You are correct. if app_ble_ext_wakeup_off is set, there is a wake up every 10seconds for a short period.
If app_ble_ext_wakeup_on is set, the wakeup per 10 seconds is gone. But after app_ble_ext_wakeup_on is called, you will not be able to use app_timer_set command to set a timer event and wake up DA14580 by the timer event in extended/deep sleep mode.