Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to disable SPI and TWI communication without interrupting GPIO.

Hi

I am using nrf51822 , sdk version 11 and softdevice version 130

In project I am trying to disable SPI1 and TWI0 channel by using following command

NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;

NRF_SPI1->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos);

For TWI, above command fails to disable TWI0 communication. (I am using 'deprecated' files for TWI communication)

For SPI, after disable SPI ,it also affect  GPIO's working, device unable to sense input and also fails to generate output. I also tried with re-initialization of GPIO which giving ble disconnection error.

I want help to disable SPI and TWI channel and also way to change communication channel from SPI 1 to SPI 0. 

Thanking you.