SPI slave power consumption

Hello

According to the following ticket  SPI slave mode power usage  SPI-slave interface should not increase power consumption in idle mode. I did some testing and as soon as I set CONFIG_SPI_SLAVE=y the current consumption increases by around 250 uA even though cs-pin is not selected. If cs-pin is selected the power consumption rises further above 1mA.

Is there something I can do in order to prevent increased idle power consumption?

The prj.conf and the relevant dts-overlay are as follows

The prj.conf and the relevant dts-overlay are as following

CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_USE_SEGGER_RTT=y

CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y

CONFIG_GPIO=y
CONFIG_SERIAL=n
CONFIG_SPI=y
CONFIG_SPI_SLAVE=y
CONFIG_I2C=n

&pinctrl {
    spi3_default: spi3_default {
            group1 {
                psels = <NRF_PSEL(SPIS_SCK, 1, 13)>,
                        <NRF_PSEL(SPIS_MISO, 1, 12)>,
                        <NRF_PSEL(SPIS_MOSI, 1, 11)>,
                        <NRF_PSEL(SPIS_CSN, 1, 14)>;
            };
    };
    spi3_sleep: spi3_sleep {
            group1 {
                psels = <NRF_PSEL(SPIS_SCK, 1, 13)>,
                        <NRF_PSEL(SPIS_MISO, 1, 12)>,
                        <NRF_PSEL(SPIS_MOSI, 1, 11)>,
                        <NRF_PSEL(SPIS_CSN, 1, 14)>;
                    low-power-enable;
            };
    };
};

&spi3 {
    compatible = "nordic,nrf-spis";
    status = "okay";
    def-char = < 0 >;
    pinctrl-0 = <&spi3_default>;
    pinctrl-1 = <&spi3_sleep>;
    pinctrl-names = "default", "sleep";
};

Thank you!

Best regards

Sandro

Parents Reply
  • Hi,

    By "device" I mean the SPI peripheral, you should be able to uninit the peripheral by using the device power management api and setting the device to PM_DEVICE_STATE_SUSPENDED. 

    Note I've seen a bug report where the pins aren't set to their default state after initializing the device, so you might need to call gpio_pin_configure() and set them back to default, meaning Input, with No pull and input buffer disconnected to get the lowest power consumption,

    If I misunderstood you, please elaborate! 

    regards

    Jared 

Children
  • Hi,

    The Blog device power management api suggests using 'pm_device_state_set()'  to suspend a device. This function has been removed in Zephyr 3.1.0, now 'pm_device_runtime_put()' and 'pm_device_runtime_get()' should be used as far as I know (only after enabling with 'pm_device_runtime_enable()'). But when I call 'pm_device_runtime_enable()' for a device with device-tree entry 'compatible="nordic,nrf-spis"' it will return -ENOTSUP since no power-management callback is implemented/registered in the file "ncs\v2.4.0\zephyr\drivers\spi\spi_nrfx_spis.c"

    Therefore the question is whether this feature will be added or if there is another way of suspending the device?

    Best regards

    Sandro

  • Hi Sandro,

    Sorry, I totally mixed it with the SPI peripheral, I had forgotten that you were using SPIS not SPI. You are totally correct in that the device power management module hasn't been implemented for the SPIS driver. The alternative is to use the nrfx functions directly and call nrfx_spis_uninit(). You should also reconfigure the SPI pins back to the GPIO default by using nrf_gpio_cfg() similar to what it's done here,

    regards

    Jared 

Related