0

I'm using the NXP port of FatFS with an SD card using SPI for connection.

f_mount returned FR_OK

When I call this code to open a file called "skript.txt" in the root folder:

printf("Trying to open file %s\n", this->name);
//
// Open the hex file
//
FRESULT fr  = f_open(this->hf, this->name, FA_OPEN_EXISTING | FA_READ);

if (FR_OK != fr)
{
    printf("File open error %d\n", fr);
    result = false;
}

I get this output in the debug log:

Mounting SD card filesystem
f_mount result = 0

Trying to open file \skript.txt
File open error 9

The file skript.txt does exist in the root folder of the SD card.

Clearly I am doing something wrong! But what?

Thanks David

1 Answers1

0

It was a goof! expecting f_open to return a FIL* when it actually required a point to an existing FIL struct.

D.