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

Disabling/enabling SPI Pins for SD Card

I want to save Power by disabling the SD Card. VCC of the card is already regulated with an external MOSFET switch and controlled by a pin of the nRF. The problem now is, that the SPI data lines still power the SD Card. Therefore, I want to disable them. Is this possible, without having to redo the initialisation process of the SD Card? By the initialisation process I mean the following:

	/**
* @brief  SDC block device definition
* */
NRF_BLOCK_DEV_SDC_DEFINE(
    m_block_dev_sdc,
    NRF_BLOCK_DEV_SDC_CONFIG(
            SDC_SECTOR_SIZE,
            APP_SDCARD_CONFIG(SDC_MOSI_PIN, SDC_MISO_PIN, SDC_SCK_PIN, SDC_CS_PIN)
     ),
     NFR_BLOCK_DEV_INFO_CONFIG("Nordic", "SDC", "1.00")
);
static diskio_blkdev_t drives[] = {
      DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)  };

diskio_blockdev_register(drives, ARRAY_SIZE(drives));

NRF_LOG_INFO("Initializing disk 0 (SDC)...\r\n");


for (uint32_t retries = 3; retries && disk_state; --retries)
{
      disk_state = disk_initialize(0);
}
if(disk_state)
{
     NRF_LOG_INFO("Disk initialization failed.\r\n");
     return false;
}
Related