Background: I am using an nRF52832 Development Kit with this microSD card in this breakout board. The card is powered at 3 V (I've tested running off the dev kit regulator and an external power supply). I am using 22 ohm series resistors on the SCLK, SDO, SDI, CS lines and a 10k ohm pullup resistor on SDO.
I am using FatFs to mount the SD card and write to a file. I am able to initialize the card, but my call to
f_open returns error code 13 (
After some digging, I was able to determine that
FR_NO_FILESYSTEM is being returned from a call to
find_volume, which tries to find a FAT partition on the drive. I understand that this means reading sector 0 of the card and reading bytes 510 and 511. For a valid FAT volume, those bytes should be 0x55 0xAA. However, looking at the SPI transactions, my card seems to be returning 0x00 0x00.
I've tried formatting my SD card as FAT32 using the official SD Card Formatter, the Windows format tool, OS X's Disk Utility, Ubuntu gparted, and dd, but to be sure, I used Hex Workshop to read the boot sector of the SD card on my laptop and did see 0x55 0xAA at the appropriate position:
I'm using a Saleae Logic Pro to capture the SPI sequence. I am not sure the best way to share the whole capture, but here is a table showing all the decoded values: http://pastebin.com/gQh07QfE
You can see that the initialization works alright (it responds to CMD0, CMD8, etc), and towards the end returns 0xFE (which I understand indicates a valid data token?), but then 0x00 0x00 instead of 0x55 0xAA.
My ffconf.h is here: http://pastebin.com/1XRa7c94 -- My sdmm.c is slightly modified to use the Nordic SPI API (
nrf_drv_spi_transfer) and delay function (
nrf_delay_us). I am using a separate GPIO pin as my CS (
Does anyone have any ideas about why this read isn't working?