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

nRF51422 SPI disable/enable with softdevice

I have an issue with waking up SPI communication after sleep.

Befor I go to sleep I'm disabling SPI communication:

NRF_SPI0->ENABLE = 0;
NRF_SPI1->ENABLE = 0;

Handler function triggered by timer (which is responsible for wake-up) enabling SPI:

NRF_SPI0->ENABLE = 1;
NRF_SPI1->ENABLE = 1;

and send/receive data

err_code = nrf_drv_spi_transfer....

I'm getting err_code = 17 (NRF_ERROR_BUSY?) which causing reset.

When I remove commands:

NRF_SPI0->ENABLE = 0;
NRF_SPI1->ENABLE = 0;
NRF_SPI0->ENABLE = 1;
NRF_SPI1->ENABLE = 1;

SPI communication works fine, but current consumption is higher then expected during sleep

Should I disable SPI in different way?

Regards, Marcin

Related