I’m trying to read WAV header info from the SD card on my Daisy Patch. I’ve pored over the FatFS docs, read multiple examples, and even referenced other projects. Best I can tell I’m using the SDMMC/FatFS libraries correctly.
I can list files in directories and even stat files, but any time I try to read a file I get an error. I’ve tried multiple SD cards to no avail. Does anyone know what’s going on here? I’ve managed to pare down the code to something simple. Program and output below.
Referencing the WavPlayer code, I noticed that it concatenates the file name to fsi.GetSDPath(). I’ve just tried this updated code and still no luck. Really stumped. I tested the WavPlayer code and it compiles and runs for me just fine, so clearly this is a me issue but I can’t for the life of me figure out what I’m doing wrong/differently.
Basically you need to move the FIL file; declaration out of your main function to avoid it being allocated on the stack. If you declare it a global by adding it just under the place where you define FatFSInterface fsi; you should be able to get it to work.