Low Power with SPI peripheral Zephyr

I'm trying to achieve a low power operation on a device which has a nRF52833 module with a SPI peripheral on Zephyr. It is based on the peripheral_lbs.

The intended behaviour is for the device to be connectable but low power while not used and active on connection, to perform the callback actions.

So far I've done the following on the prj.conf:

CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Foo"

CONFIG_PM_DEVICE=y

# Peripherals
CONFIG_SERIAL=n
CONFIG_SPI=y
CONFIG_NRFX_SPIM=y
CONFIG_NRFX_SPIM1=y
CONFIG_MAIN_STACK_SIZE=4096

# Enable the LBS service

CONFIG_BT_LBS_POLL_BUTTON=y

I'm aiming for the PM module to turn off SPI while the device is asleep, which I suppose makes most of the power consumption(130uA assuming the SPI device complies with the datasheet spec)

When I declare the SPI_Uninit function on my library for the SPI device:

void LED_spiDeinit(void)
{
        LED_GPIO_Deinit();
        spim_nrfx_pm_control(&spi_dev,PM_DEVICE_STATE_SET,spi_pm_cb,NULL);
}

I get the following build error, some lines are added for reference:


Archiving ‘libdrivers__gpio.a’
Building ‘zephyr/drivers/spi/libdrivers__spi.a’ from solution ‘build’ in configuration ‘Common’
Compiling ‘spi_nrfx_spim.c’
Archiving ‘libdrivers__spi.a’


Building ‘zephyr/zephyr_prebuilt.elf’ from solution ‘build’ in configuration ‘Common’
Linking ‘zephyr_prebuilt.elf’
app/libapp.a(PCA9957.c.obj): in function `LED_spiDeinit':
undefined reference to `spim_nrfx_pm_control'
ld returned 1 exit status
Build failed

How can I solve this?

Related