Hi, my BLE application on nRF52832 is designed to select two mode to operate with 3 position slide switch when power on like ON(Mode 1) - OFF - ON(Mode 2).
At Mode 1 position, it power up and also connected to ground (LOW) as GPIO input using different contact to detect the mode position and at Mode 2 position, it power up and GPIO input is disconnected from ground (HIGH).
This issue I came across is when it sleep system off with mode 1, it draws around 0.22mA. but mode 2 is no current as expected. I thought when system off it cuts off the current draw but it seems not. Is it expected behavior? Could you please advise how to avoid it?
#define BUTTON_START 17
#define BUTTON_1 17
#define BUTTON_2 18
#define BUTTON_3 12 //Factory reset button
#define BUTTON_4 11 //SLIDE SW for POWER and MODE Selection
#define BUTTON_STOP 11
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
#define BUTTONS_ACTIVE_STATE 0
#define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4 }
#define BSP_BUTTON_0 BUTTON_1
#define BSP_BUTTON_1 BUTTON_2
#define BSP_BUTTON_2 BUTTON_3
#define BSP_BUTTON_3 BUTTON_4
static void ble_buttons_leds_init(bool * p_erase_bonds)
{
bsp_event_t startup_event;
uint32_t err_code;
err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler);
APP_ERROR_CHECK(err_code);
err_code = bsp_btn_ble_init(NULL, &startup_event);
APP_ERROR_CHECK(err_code);
*p_erase_bonds = (startup_event == BSP_EVENT_CLEAR_BONDING_DATA);
}
static void sleep_mode_enter(void)
{
//turn off Pressure Sensor
nrf_gpio_pin_set(SENSOR_GND); //set high
uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
// Prepare wakeup buttons.
err_code = bsp_btn_ble_sleep_mode_prepare();
APP_ERROR_CHECK(err_code);
// Go to system-off mode (this function will not return; wakeup will cause a reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}