Cannot Mount File System on SD Card
Hello! I have been trying to mount a file system onto an SD card for the past few weeks, to no avail.
My hardware setup is comprised of a Mikroelektronika Clicker 2 development board connected to a Velleman VMA304 SD card breakout board via SPI. The SD card is a base 2GB standard SanDisk SD card. It's not an SDHC, SDXC, etc. My software environment is MPLAB X IDE v5.10. I am using a PICkit3 to connect the development board to my computer. I have attached a picture of my hardware.
I know the PICkit and development board work correctly since I have been using them for the other parts of a larger project. I also know the SD card breakout board and the card itself both work, as I can write to them with an Arduino.
As I understand it from reading the relevant portions of the “Driver Libraries_v111.pdf” and “System Service Libraries_v111.pdf” documents, the file system service library is an abstraction layer for the SD card driver library, which in turn is an abstraction layer for the SPI library. This seems to be the case when looking at the “sdcard_fat_single_disk” example project bundled with MPLAB X. Based on that example project, it appears that neither a SPI nor an SD card driver needs to be opened before mounting the file system. Simply mounting a file system without opening the other two drivers did not work for me, so I tried opening either just the SD card driver or both the SPI and SD card drivers before attempting to mount the file system, which also did not work. Pictures included below. The SPI driver is able to open successfully, though the SD card driver is not, regardless of whether the SPI driver has been opened first.
I have attempted to replicate the Harmony configuration settings of the aforementioned example project as closely as possible, which did not work. I have attached screenshots of my current configuration settings, which are as similar to those of the example project as possible. The only differences are the following:
“SPI Module ID” of “SPI Driver Instance 0”, which is “SPI_ID_2” since that is the only available SPI interface on the development board
In the first group of SPI check boxes, I use “Standard Buffer Mode” instead of “Enhanced Buffer (FIFO) Mode”, since that option isn’t available to me
Screenshots of my pin configuration are also included. It is the following:
CS: G13, gray
SCK: G6, orange
MISO: G7, blue
MOSI: G8, purple
3.3 V logic level
I have checked with a logic analyzer that the chip select pin is brought low for the duration of the write and data is being written to the clock and master data out lines. I’ve tried using a write protect pin and using the file system driver’s auto mount feature, neither of which have solved the problem.
I have tried the solutions mentioned in these posts as well, none of which have worked for me:
SD Card Cannot Mount (No MISO): https://www.microchip.com/forums/m935672.aspx
i can't mount a device for file system service with SD card: https://www.microchip.com/forums/m858833.aspx
Actual Working SD Card Project?: https://www.microchip.com/forums/m1025637.aspx
Two additional strange quirks are 1. The SD card driver opens successfully when I uncheck “Register with File System?” in the SD card driver options menu in Harmony, and 2. The SPI driver stops working when I remove SPI driver instance 1 in the Harmony menu, even though driver instance 0 uses the correct SPI module ID.
All of the pictures mentioned above are located in this album: https://imgur.com/a/QnoASoU
Any guidance would be greatly appreciated, thank you so much!