Hey. I want to wake my s110 device every 30-40 second to advertise for a few seconds only. Is there an example on this or if someone could guide me in the right direction?
Hey. I want to wake my s110 device every 30-40 second to advertise for a few seconds only. Is there an example on this or if someone could guide me in the right direction?
Hi,
Take a look at the ADC example:
follow the ADC_SAMPLING_INTERVAL, set tick to 1000*40 for 40 seconds etc. See the timer_init() and the callback adc_sampling_timeout_handler() in the handler, do start_advertise(), also the APP_ADV_TIMEOUT_IN_SECONDS defines how many seconds advertisning is on if not connected.
Depending on what you will use it for, if connected and you want to disconnect later on, check that TX transmitt done etc, I used the write characteristics handler to tell Ble module to disconnect since disconnecting from iOS is slower and triggers the reconnect direct.
uint32_t err_code;
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
APP_ERROR_CHECK(err_code);
There is an application note with both write and read charactersitics you might want to look at, search for nAN-36 from Nordic.
Also you might want to disable the poweroff code in the event handler for when advertise timeout. The timer in the example uses RTC1 and that uses the 32khz clock crystal or internal RC if that is used. So if you are going to do ADC, the example waits on the high-frquency clock (16Mhz) to stabilize before doing ADC sample, might be usefull depending what you do.
If there is more that can be done to powersave besides put power_manage (sd_app_evt_wait) in main loop, I would also be interested to know.
Thank you, this looks promising!
Hi, could someone from Nordic update the link please?