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

Current draw when using SPI with MISO and MOSI on the same pin

Hi!

We have a peripheral which uses an 'unconventional' SPI configuration for its data transfer. Among other things, it sends and receives data on the same SPI line, meaning that when defining the SPI lines we set the MISO and MOSI to the same GPIO.

When measuring current in an idle state, this set up seems to 'leak' current, even if the SPI instance is un-initialized before entering sleep mode.

to be more specific:

1. an SPI instance is initialized where both MISO and MOSI are set to the same GPIO pin.

2. some data is transferred and/or received from the peripheral without special issues.

3. The SPI instance is uninitialized.

4. The device enters 'sleep mode' by using the nrf_pwr_mgmt_run();

5. When initializing the SPI with the MOSI-MISO on the same pin, a current draw of ~20uA is measured. When initializing the SPI with MISO set to PIN_NOT_USED, a current draw of ~5uA is measured. No other change to the code is applied.

Any idea what could be causing this or how to handle it? is there a 'correct' state for SPI instances to be 'placed into' when going to sleep?

Thanks!

Parents
  • Hello,

    It sounds like your pin is still in output mode, causing the nRF to use a bit of power to hold it high/low. When you uninitialize the SPI, try to set all the SPI pins as disconnected-inputs.

    You can do this by using the function nrf_gpio_cfg_default() from nrfx_gpiote_out_uninit.c, or nrf_drv_gpiote_out_uninit() from nrf_drv_gpiote.h/c.

    BR,

    Edvin

Reply
  • Hello,

    It sounds like your pin is still in output mode, causing the nRF to use a bit of power to hold it high/low. When you uninitialize the SPI, try to set all the SPI pins as disconnected-inputs.

    You can do this by using the function nrf_gpio_cfg_default() from nrfx_gpiote_out_uninit.c, or nrf_drv_gpiote_out_uninit() from nrf_drv_gpiote.h/c.

    BR,

    Edvin

Children
No Data
Related