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

sd card example not working fine

Hi All,

I am working on fatfs example from sdk 12.2.0 on pca10040, nrf52 dk, nrf52832. And i did not change anything in the code but it seems that my sd card is not getting initialized as i am getting following message on putty:-

APP:INFO: FATFS example.

APP:INFO:Initializing disk 0 (SDC)...

APP:INFO:Disk initialization failed.

and on debug, my code goes into this if condition in diskio_blkdev.c file:- Line no.-81

if (m_drives[drv].config.wait_func == NULL)
{
    m_drives[drv].config.wait_func = default_wait_func;
}

can anyone help me understand the reason behind why this is happening and how i should deal with it?

Thank in advance.

Regards

Parents Reply Children
  • I am having the same issue using SDK 15.3 and Segger IDE with the fatfs example on pca10040 and nrf52 dk.

    I get "Disk initialization failed" as the 

    m_drives[drv].config.wait_func = default_wait_func;

    Returns
    m_drives[drv].config.last_result == NRF_BLOCK_DEV_RESULT_IO_ERROR

    I have tried the setting APP_SDCARD_FREQ_DATA and APP_SDCARD_FREQ_INIT to lower frequencies and also setting the NRF_SPI_DRV_MISO_PULLUP_CFG to NRF_GPIO_PIN_NOPULL but I still get the same error.

    I'm also pretty sure the VDD is the right way around as an LED lights up on the SD board (mikroBUS microSD click).

    Any pointers on what else to try gratefully received...

    Nick

  • I also checked the SD card is formatted OK (MS-DOS (FAT16)) and that I can write to it via PC.

    I have two SD cards and get the same error with both and they take 3.3v not 5v.

  • Have you double-checked the connections to the SD card? I have tested this example multiple times with different SD cards and have not experienced issues when the connections are correct. Please also test with different SD cards and sockets if you have made sure everything else is correct.

    If nothing of this helps, please post a new case where you describe your issue in detail, along with all debugging steps you have tried.

  • Hi there, I also experienced issues with the SD card.

    This worked for me:

    - Set all pins to PULLUP or NOPULL

    - Place a 20K resistor between 3.3V and MISO (basically an external pullup)

    I also experienced a problem where if I have certain NRF pins set as one of the SD pins, the SD example would freeze and not proceed past a certain point, even with nothing connected to the board. (Example being setting P0.09 to SD SPI CLK will freeze, but changing to P0.20 works even though nothing is connected to the board. (This appears to be an SDK bug)

Related