This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sleep mode in mesh SDK.

hi I used light switch example in mesh SDK. i want put device in sleep mode if the device is detected sunlight (using solar panel). if again darkness detect means it will wake up. my problem is in while the device in sleep mode its consuming 3mA its too much for my application. as per the spec, it should take around 1.2uA. why it's consuming too much power. here is my code.

static void solar_inttrupt(void * p_context)
{

nrf_gpio_cfg_default(ONOFF_SERVER_0_LED);
nrf_gpio_cfg_default(13);
hal_led_pin_set(ONOFF_SERVER_0_LED, 0);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- NRF SLEEP-----\n");
nrf_gpio_cfg_sense_input(13, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_LOW); // Added this
sd_power_system_off();
}

iint main(void)
{

// sleep_mode_enter();
NRF_POWER->DCDCEN = 1;
initialize();
execution_start(start);
NRF_LOG_DEFAULT_BACKENDS_INIT();
ret_code_t ret_code = nrf_pwr_mgmt_init();
APP_ERROR_CHECK(ret_code);
saadc_init();
nrf_gpio_cfg_input(13, NRF_GPIO_PIN_PULLDOWN);
nrf_gpio_cfg_output(ONOFF_SERVER_0_LED);
APP_ERROR_CHECK(app_timer_create(&m_button_state_timer_id, APP_TIMER_MODE_SINGLE_SHOT, button_state_timeout_handler));

APP_ERROR_CHECK(app_timer_create(&solarpanel_timer_id, APP_TIMER_MODE_SINGLE_SHOT, solar_inttrupt));
BUTTON_STATE_MEAS_INTERVAL= APP_TIMER_TICKS(100);
app_timer_start(m_button_state_timer_id, BUTTON_STATE_MEAS_INTERVAL, NULL);
for (;;)
{
(void)sd_app_evt_wait();
nrf_drv_saadc_sample();
nrf_pwr_mgmt_run();
__SEV();
__WFE();
__WFE();
uint8_t sp_status = nrf_gpio_pin_read(solar_panel);
if(sp_status== 0 && solar_flag==1)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Intrrupt cleared-----\n");
app_timer_stop (solarpanel_timer_id);

 solar_flag=0;
}

if(sp_status==1 && solar_flag==0)
{
SOLAR_STATE_MEAS_INTERVAL= APP_TIMER_TICKS(5000);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "-----Solar Intrrupt occured-----\n");
 app_timer_start(solarpanel_timer_id, SOLAR_STATE_MEAS_INTERVAL, NULL); // after 5 seconds this will call solar_inttrupt() function.
 solar_flag=1;
 }
}
}

Parents Reply Children
No Data
Related