Hello again,
fortunately I made some progress using the IoT-SDK v0.8.0 on nRF51. I extended the MQTT-example to my needs, but there are still some questions. The final device is battery-powered and should transmit some sensor values periodically, so power management is very important.
The program flow would be:
- Wake up
- Read sensors
- Start advertising
- Connect to MQTT broker after connection is established
- Publish values
- Disconnect
- Go to sleep for x minutes and wake up again
To optimize current consumtion, I intend to power off all unnecessary peripherals:
- As far as I can tell, the Timer0 is needed by the Softdevice itself, so there is no optimization possible here.
- Disable app_trace (UART)
- Disable LEDs and buttons
Which other peripherals are used by the Softdevice itself and the other components in the MQTT-example?
I found some app_timers, but I don't understand the difference between app_timer and nrf_drv_timer. I can only assume, that nrf_drv_timer is using the hardware timer peripheral and app_timer is creating a timer instance in the Softdevice itself, so any app_timer is derived from Timer0. Is this correct? If so, how do I set a timer interval (interval between two app_timer-Interrupts)? Is there any further documentation explaining the background? I did not find anything about this in the S130-Documentation of the underlying SDK v8.1.0.
Next questions are about ble_stack_init(). Where is the transmission power of the radio part set?
Does the initalization
SOFTDEVICE_HANDLER_APPSH_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true);
mean, the Softdevice is running on Low-Frequency-Oscillator? Can I save energy by running "my" application also on LF only or do some parts (IP-Stack) need the HSE-Oscillator?
Next question: what is the influence of calling sd_app_evt_wait() on power consumption?
Last question: What is the best way to implement the long sleeping time with max. power saving? Would it be possible to wakeup the device from "System off"-Mode with a RTC-interrupt which is linked to an GPIO (in order to create an external interrupt event)?
Thank you very much for your support!