I'm using the NRF52840-DK with the SB40 jumper cut, then powering through P21 and measuring with an ammeter across P22. USB is unplugged during measurement. I'm using zephyr with ncs v1.2.0.
I have built the samples/boards/nrf/system_off example and I was able to get about 400uA of current draw. By modifying the example to include CONFIG_SERIAL=n I was then able to get roughly 3uA. I have since tried to modify that example to include bluetooth advertising, but I can't get the current draw below 1.3mA. Here is my code:
#include <zephyr.h>
#include <device.h>
#include <power/power.h>
#include <bluetooth/bluetooth.h>
#include <hal/nrf_gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME 1000
/* 1000 msec = 1 sec */
#define SLEEP_TIME 1000
#define BT_LE_ADV_CONN_NAME_SLOW BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
BT_LE_ADV_OPT_USE_NAME, \
BT_GAP_ADV_SLOW_INT_MIN, \
BT_GAP_ADV_SLOW_INT_MAX)
static u8_t mfg_data[] = { 0xff, 0xff, 0xAB };
static const struct bt_data ad[] = {
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
};
void main(void)
{
u32_t cnt = 0;
sys_pm_ctrl_disable_state(SYS_POWER_STATE_DEEP_SLEEP_1);
int err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME_SLOW, ad, ARRAY_SIZE(ad),
NULL, 0);
if (err) {
printk("Advertising failed to start (err %d)\n", err);
return;
}
while (1) {
cnt++;
k_sleep(SLEEP_TIME);
}
}
and prj.conf
CONFIG_GPIO=y CONFIG_OPENOCD_SUPPORT=n CONFIG_ASSERT=y CONFIG_BT=y CONFIG_BT_BROADCASTER=y CONFIG_BT_DEVICE_NAME="Zephyr Test" CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y CONFIG_SYS_PM_STATE_LOCK=y CONFIG_SERIAL=n
The advertising itself appears to work fine. Is this low power advertising supported? If so, could you please tell me what I am missing here?