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

SPIS current drain, depends on GPIO config?

Hello all,

I'm working on a device using nRF52832, interfacing to another microcontroller. I was seeing higher than expected consumption, so started to reduce code to find where it was.

The nRF52 is now only configured as SPIS, based on the spis peripheral example. If I start OFF mode before doing spi_init() I see the expected ~0.4uA. But if I do spi_init() first I see a few uA. I checked for pull-up/down on either micro without success.

After chasing this I found that nrfx_spis_init() configures slave output as follows:

    {
        nrf_gpio_cfg(p_config->miso_pin,
                     NRF_GPIO_PIN_DIR_INPUT,
                     NRF_GPIO_PIN_INPUT_CONNECT,
                     NRF_GPIO_PIN_NOPULL,
                     p_config->miso_drive,
                     NRF_GPIO_PIN_NOSENSE);
        miso_pin = p_config->miso_pin;
    }

When I change NRF_GPIO_PIN_INPUT_CONNECT to NRF_GPIO_PIN_INPUT_DISCONNECT, I see a reduction in power consumption.

Is this expected? Is it a bug or am I breaking something?

I couldn't find a clear explanation or schematic of the GPIO so I can't really tell, does anyone know where to find it?

I'm a bit confused here...Any help is welcome

Thanks!!

  • Hi,

     

    When I change NRF_GPIO_PIN_INPUT_CONNECT to NRF_GPIO_PIN_INPUT_DISCONNECT, I see a reduction in power consumption.

    Is this expected? Is it a bug or am I breaking something?

    You haven't broken anything, but you have disconnected the IO internally. This means that the MISO pin cannot be sampled by the peripheral itself.

    By setting this field to _CONNECT, it ensures that the pin buffer internally to the chip is connected.

    Setting the GPIO to _DISCONNECT while operating at the input configuration ensures that the pin does not float while you're in sleep. Floating GPIOs tend to cause high current consumption, as you're seeing when entering SystemOff mode.

     

    I couldn't find a clear explanation or schematic of the GPIO so I can't really tell, does anyone know where to find it?

    There's been many discussions on this topic. Try searching the forum (or other EE forums) for "floating GPIO" to get a more detailed description of the problem.

    Bottom line: You should always disconnect the pin buffer or set your inputs to a defined level when entering sleep mode.

    Kind regards,

    Håkon

Related