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

SD Card FATFS example not working at low init frequency, but does work at higher frequencies

Hi,

I have been trying to use the FATFS example (SDK 15.2) to work with an SD card on the NRF52840 DK, with an Adafruit SD card breakout (I removed the 5V level shifter, and directly wired the pins of this breakout).

I am using genuine Sandisk SD cards, and have tried with a 512mb card, and a newer 32gb card. I have verified my SD card breakout works with these cards by using an Adafruit feather with an example Arduino SD card sketch - both cards work fine with the Arduino code.

With the FATFS example unmodified (and correctly wired up), it fails to initialize the disk and outputs:  "Disk Initialization failed.1". At this stage I checked the SPI data output from the NRF52840dk board with an oscillscope, and it clocks ok, chip select reacts as expected, and MOSI looked sensible (However I haven't yet verified the individual commands sent on MOSI are as expected).

I then tried changing the MISO pull configuration to NO_PULL, which didn't work. Then I set the CLK and MOSI pins to be high drive with the following command:

nrf_gpio_cfg(SCK_PIN,
                 NRF_GPIO_PIN_DIR_OUTPUT,
                 NRF_GPIO_PIN_INPUT_DISCONNECT,
                 NRF_GPIO_PIN_NOPULL,
                 NRF_GPIO_PIN_H0H1,       // Require High Drive low/high level
                 NRF_GPIO_PIN_NOSENSE);

This also didnt work.

Then I changed the APP_SD card SPI initialization frequency from 250khz to 1MHZ and it now works (the 2 previous things I tried, are also included in the working code).

Is this a known bug? I don't mind if the fixes I have used are expected - but I am a little concerned the underlying problem is probably still there.

I noticed on the Adafruit SD card module the left over SDIO data pins are left floating, and on some SD breakout boards (e.g Pololu), there are pull ups on those pins - could this be a possible reason?

Parents Reply Children
Related