I am writing a BLE application on the nRF52832 using S132 v6.0 and SDK 15.2, and my application is using the nrfx_SPIM driver. I find that once I initialize the spim driver, my device sleep power consumption goes up to ~300uA. If I comment out my function that initializes the SPIM driver, then I am able to achieve the magical ~2uA sleep power. I read through the forums here, and found this topic here, and decided to give the suggestions on there a try, by uninitializing the spim driver once I am done with all the SPI transactions. However, it didn't make any difference to my sleep power. I also read that the uninit function in SDK15.2 was not releasing the GPIOs, and that could be causing my issues. So I also tried manually setting the GPIOs that the SPIM driver is using to its POR default config, and no luck there either...
I know it can't be a GPIO leakage issue, because the particular eval board I am using has all the SPI pins floating. So even if the driver was pulling the pins high/low, there is no way for leakage since they are floating.
Here is my function for initializing SPIM0:
static void config_SPI(void) { nrfx_spim_config_t spi_config = NRFX_SPIM_DEFAULT_CONFIG; spi_config.frequency = NRF_SPIM_FREQ_1M; spi_config.ss_pin = NRFX_SPIM_SS_PIN; spi_config.miso_pin = NRFX_SPIM_MISO_PIN; spi_config.mosi_pin = NRFX_SPIM_MOSI_PIN; spi_config.sck_pin = NRFX_SPIM_SCK_PIN; //spi_config.dcx_pin = NRFX_SPIM_DCX_PIN; //spi_config.use_hw_ss = true; spi_config.ss_active_high = true; spi_config.mode = NRF_SPIM_MODE_1; spi_config.bit_order = NRF_SPIM_BIT_ORDER_MSB_FIRST; //APP_ERROR_CHECK(nrfx_spim_init(&spi, &spi_config, spim_event_handler, NULL)); APP_ERROR_CHECK(nrfx_spim_init(&spi, &spi_config, NULL, NULL)); //APP_ERROR_CHECK(nrfx_spim_xfer(&spi, &xfer_desc, 0)); }
Here is what I am calling in the end to uninitialize the SPIM driver in order to lower the sleep power, but no luck:
nrfx_spim_uninit(&spi); //uninit SPIM peripheral once we are done configuring AS3992 nrf_gpio_cfg_output(NRFX_SPIM_SS_PIN); nrf_gpio_pin_clear(NRFX_SPIM_SS_PIN); // keep SS pin low... nrf_gpio_cfg_default(NRFX_SPIM_MISO_PIN); nrf_gpio_cfg_default(NRFX_SPIM_MOSI_PIN); nrf_gpio_cfg_default(NRFX_SPIM_SCK_PIN);