Issue with fmount / SD Card / SPI (Any help would be appreciated)
I've been looking through forums, posts, youtube videos, etc and I'm still having trouble getting my card to mount correctly.
The code I'm having trouble with is this:
FRESULT fresult; // result
FATFS fs; // file system
HAL_Delay (500);
fresult = f_mount(&fs, "/", 1);
if(fresult != FR_OK)
{
debugPrintln(&huart1, "ERROR!!! in mounting SD CARD...\n\n");
}
else
{
debugPrintln(&huart1, "SD CARD mounted successfully...\n\n");
}I've seen some people use "1" in the fmount command (mount immediately) and some use a 0 (delayed mount). The problem I'm having is when I use a 1, I get the error "FR_DISK_ERR". When I use a 0, I get FR_OK.
So, naturally, I would think, "no problem, I'll just use 1 since that seems to work". However, when I have the SD card removed, it ALSO works using 1, which doesn't make sense to me.
So, I have a few potential problems:
1) I have a hardware problem and it's not seeing the SD card
2) I have a SW setup issue with the drivers
The problem is I don't fully understand what this is doing, to be honest. I'm not sure if it's testing software settings or if it's actually trying to communicate to hardware. I'm expecting it to do so over SPI pins but maybe I don't have it linked to the SPI bus? I have a scope probe on the clock line and I'm not seeing any signals, so that seems like a big red flag that it's not doing what it's supposed to (that said, I don't see in the code where it would actually try to communicate to the SD card via SPI).
Can anyone explain to me what I might be seeing, what I should expect, where I can look, etc? I'm racking my brain, scouring the internet trying to understand the problem and I just don't. I've been at it for much longer than I care to admit and I should've stopped for lunch about 2-3 hours ago . . . heh.
Anyway, thought I'd throw this out there in case someone else can shed some light on this. Thanks!