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

gpiote current

i use SDK11.0 in 51822,    I just need use BSP_BUTTON_1 interrupt, don't need BSP_BUTTON_0 interrupt, but i must initial BSP_BUTTON_0 interrupt, otherwise the current will be increse about 0.2mA

it means if I initial the gpiote as below, the current will big.

static void gpiote_init(void)
{
ret_code_t err_code;

err_code = nrf_drv_gpiote_init();  // int for g_sensor
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
in_config.pull = NRF_GPIO_PIN_PULLUP;
in_config.sense = NRF_GPIOTE_POLARITY_HITOLO,

err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_1, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BSP_BUTTON_1, true);
}

but if I initial the gpiote as below, the current is OK.

static void gpiote_init(void)
{
ret_code_t err_code;

err_code = nrf_drv_gpiote_init();  // int for g_sensor
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
in_config.pull = NRF_GPIO_PIN_PULLUP;
in_config.sense = NRF_GPIOTE_POLARITY_HITOLO,

err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_0, &in_config, in_pin_handler);   // why need init button 0 
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BSP_BUTTON_0, true);

err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_1, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BSP_BUTTON_1, true);
}

or 

static void gpiote_init(void)
{
ret_code_t err_code;

err_code = nrf_drv_gpiote_init();  // int for g_sensor
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
in_config.pull = NRF_GPIO_PIN_PULLUP;
in_config.sense = NRF_GPIOTE_POLARITY_HITOLO,

err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_0, &in_config, in_pin_handler);   
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BSP_BUTTON_0, true);

}

it means i can't kill BSP_BUTTON_0 gpiote init code ,even i didn't need use BSP_BUTTON_0 interrupt.

Note:  I already init the BSP_BUTTON_0 and BSP_BUTTON_1 in front of the gpiote_init() as below: 

nrf_gpio_cfg_input(1,GPIO_PIN_CNF_PULL_Pullup);   // P0.01  BSP_BUTTON_0 
nrf_gpio_cfg_input(4,GPIO_PIN_CNF_PULL_Pullup);   // P0.04  BSP_BUTTON_1 

Parents
  • 0.2mA corresponds to current going through a pull resistor (3V / 13kOhm = 0.23 mA). So I would suspect that not initializing BSP_BUTTON_0 leads to some pull resistor being active while the pin is physically pulled the other way. Can you please post schematics of the design and two hex files: One where the current is OK, and one where you see high current. Then I can compare and see what is actually the difference.

Reply
  • 0.2mA corresponds to current going through a pull resistor (3V / 13kOhm = 0.23 mA). So I would suspect that not initializing BSP_BUTTON_0 leads to some pull resistor being active while the pin is physically pulled the other way. Can you please post schematics of the design and two hex files: One where the current is OK, and one where you see high current. Then I can compare and see what is actually the difference.

Children
No Data
Related