Hi All,
I am using the nRF51822 board and have it connected to a micro SD card shield using SPI.
I have not changed anything in the example file with the exception of redefining the pins in the main.c file to the following (according to the table here: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.2.0%2Fapp_sdcard_example.html&cp=4_0_4_4_5_30):
#define SDC_SCK_PIN 29 ///< SDC serial clock (SCK) pin.
#define SDC_MOSI_PIN 25 ///< SDC serial data in (DI) pin.
#define SDC_MISO_PIN 28 ///< SDC serial data out (DO) pin.
#define SDC_CS_PIN 24 ///< SDC chip select (CS) pin.
The project builds with zero errors or warnings but upon loading, the following is output to PuTTY:
APP:INFO:
FATFS example.
APP:INFO:Initializing disk 0 (SDC)...
APP:INFO:Capacity: 30 MB
APP:INFO:Mounting volume...
APP:INFO:Mount failed.
I have tried using a different micro SD card but got the following output:
APP:INFO:
FATFS example.
APP:INFO:Initializing disk 0 (SDC)...
APP:INFO:Disk initialization failed.
I have taken a look at the following thread and tried lowering the SPI frequency to 125 kHz as recommended but the output was exactly the same for both SD cards.
https://devzone.nordicsemi.com/f/nordic-q-a/25951/sd-card-example-not-working-fine/102224#102224
The f_mount function seems to be returning "FR_INVALID_DRIVE". What could be causing this?
I have also read that the MOSI and SCK pins might need to be set to "high drive" according to this thread:
I added the following code before the fatfs_example() function in main.c in order to set the pins to "high drive" (although I'm not entirely sure this is correct):
nrf_gpio_cfg(SDC_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);
nrf_gpio_cfg(SDC_MOSI_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);
There was again no change to the output.
Any help would be greatly appreciated and please let me know if there is any other info I should provide.
Cheers,
~Brandon