Hello, I am using the nRF51822 with SDK 10.0, S110 softdevice, and a SPI slave interface. The SPI slave interface works, but the standby power consumption of the nRF is high, ~300 uA. I suspect that the high speed crystal is running in the background.
I use an interrupt on a pin to wake the nRF and perform the SPI transfer. Upon waking I signal the master that I am ready with a separate output pin. When the transfer is done I go back into power management via sd_app_evt_wait().
Here is the wake-up pin initialization:
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);// Configure event handler for EXTERNAL_WAKEUP_PIN, low accuracy for low power
nrf_drv_gpiote_in_config_t wakePinConfig = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);err_code = nrf_drv_gpiote_in_init(EXTERNAL_WAKEUP_PIN, &wakePinConfig, wakeupHandler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(EXTERNAL_WAKEUP_PIN, true);
SPI Slave initialization:
nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG(SPIS_INSTANCE_NUMBER);
spis_config.miso_pin = SPIS_MISO_PIN;
spis_config.mosi_pin = SPIS_MOSI_PIN;
spis_config.sck_pin = SPIS_SCK_PIN;
spis_config.csn_pin = SPIS_CSN_PIN;
spis_config.mode = NRF_DRV_SPIS_MODE_1;
spis_config.bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST;
spis_config.def = DEF_CHARACTER;
spis_config.orc = ORC_CHARACTER;// Open the SPI peripheral
err_code = nrf_drv_spis_init(&m_spis, &spis_config, spi_slave_event_handler);
APP_ERROR_CHECK(err_code);
I have tried enabling the SPI interface on-the-fly in my wakeup handler but this did not help. It worked, but the power consumption is the same, e.g.:
Wakeup event:
nrf_drv_spis_init(...) raise_handshake_output() wait for transfer event... lower_handshake_output() nrf_drv_spis_uninit(...) sd_app_evt_wait() // wait for next Wakeup Event.
I know that my CSN input pin is high at all times except when the handshake output has been raised to signal the master.
Other details:
// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, NULL);
The standby current is measured with a high speed current to voltage device in series with VCC and an oscilloscope where the advertising interval can also be observed.