This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

open drain output to GPIO input pin with pullup

Hi

I have a charger IC for a lithium ion battery on a custom board with an nRF52832. It's this one, from ST Micro, an STBC08:

www.st.com/.../stbc08.html

The charger IC has two outputs, one to indicate that it has power from the USB bus, and another to indicate the charge state. The datasheet describes both these outputs as "open drain flag" pins and, when they're indicating a value of "1" says:

Output pin in high impedance (external pull-up needed).

So I've configured the GPIO input pins on the Nordic to use the internal pullup. But alas, when the charge state changes, I don't get my interrupt.

The Nordic's running at 3.0V. If I measure the voltage on the output pin on the IC when it has state 0, it's 0.0V but when it's 1 it's only 1.2V. So, less than half of 3.0V. Does this indicate my pullup isn't working?

Here's my code.

// Note that although I have SENSE_HIGH here, I have TOGGLE below.
nrf_gpio_cfg_sense_input(PIN_CHARGER_POWER_ON, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
nrf_gpio_cfg_sense_input(PIN_CHARGER_CHARGE, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);

nrf_drv_gpiote_in_config_t in_config_toggle = {
    .is_watcher = false,
    .hi_accuracy = false,
    .pull = NRF_GPIO_PIN_PULLUP,
    .sense = NRF_GPIOTE_POLARITY_TOGGLE,
};

// Interrupt functions. Note that we never uninit these with nrf_drv_gpiote_in_uninit().
err_code = nrf_drv_gpiote_in_init(PIN_CHARGER_POWER_ON, &in_config_toggle, pwr_charger_power_on_toggle);
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(PIN_CHARGER_POWER_ON, true);

err_code = nrf_drv_gpiote_in_init(PIN_CHARGER_CHARGE, &in_config_toggle, pwr_charger_charge_toggle);
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(PIN_CHARGER_CHARGE, true);

// From now on, any edges on these pins will force a state change, but also we need to show our current state.
charger_power_on_pin_low = (nrf_gpio_pin_read(PIN_CHARGER_POWER_ON) == 0U);
charger_charge_pin_low = (nrf_gpio_pin_read(PIN_CHARGER_CHARGE) == 0U);
pwr_state_change();

Any ideas?

Related