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

How to disable/uninitialize SPI on nRF9160DK used for interfacing SD card?

Hello,

I interfaced nRF9160 and SD card using SPI. I started with this sample: ncs/zephyr/samples/subsys/fs/fat_fs.

Now once the files from SD card are read, I want to uninitialize this SPI, so it can be used by other peripheral. So how can I disable or uninitialize this SPI?

I found that by using "sdhc_spi_set_cs(data, 1)" function, I can deassert chip select pin. But using this function in main program gives the error. I included the header files, still it shows error.

Code:

	while (1) {

              if(sdcard)
              {
                  sd_card();
                  file_open();
                  sdhc_spi_set_cs(data, 1);     //Error
                  sdcard = 0;
              }
		k_sleep(1000);
	}

Related