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;
}
Parents
  • I don't understand how the SPI data lines can power your SD card if you have disconnected VCC. You can try disconnecting the pins of the SPI peripheral by setting the PSEL registers to disable:

    NRF_SPIMx->PSEL.SCK = (SPIM_PSEL_SCK_CONNECT_Disconnected<< SPIM_PSEL_SCK_CONNECT_Pos)
    NRF_SPIMx->PSEL.MOSI = (SPIM_PSEL_MOSI_CONNECT_Disconnected << SPIM_PSEL_MOSI_CONNECT_Pos)
    NRF_SPIMx->PSEL.MISO = (SPIM_PSEL_MISO_CONNECT_Disconnected << SPIM_PSEL_MISO_CONNECT_Pos)
    

    If you are using SPIM peripheral (with EasyDMA support), where x is the SPIM instance used.

    Note that you need to connect the pins again before the SPI can do any transfers again.

Reply
  • I don't understand how the SPI data lines can power your SD card if you have disconnected VCC. You can try disconnecting the pins of the SPI peripheral by setting the PSEL registers to disable:

    NRF_SPIMx->PSEL.SCK = (SPIM_PSEL_SCK_CONNECT_Disconnected<< SPIM_PSEL_SCK_CONNECT_Pos)
    NRF_SPIMx->PSEL.MOSI = (SPIM_PSEL_MOSI_CONNECT_Disconnected << SPIM_PSEL_MOSI_CONNECT_Pos)
    NRF_SPIMx->PSEL.MISO = (SPIM_PSEL_MISO_CONNECT_Disconnected << SPIM_PSEL_MISO_CONNECT_Pos)
    

    If you are using SPIM peripheral (with EasyDMA support), where x is the SPIM instance used.

    Note that you need to connect the pins again before the SPI can do any transfers again.

Children
No Data
Related