Problem flushing on Alfat OEM module

Hi,
I’m taking over a project started by another person who has now left, and I have an issue with the “Flush File” command on the AlFat OEM module.
I am communicating via SPI and am appending to a text file on SD card.
I can write and flush the file manually when testing the Alfat module, however, in the program setting the Flush File command keeps return 0x3 (operation failed). I am not sure why this is - perhaps some weird timing issue.

These are the commands used to get to the point where the issue is occuring:
I M: // init the SD card
O 0A>M:\flog.txt // open the text file for appending
W 0>64 (64 bytes of data)
(the above line is executed about 10 times, resulting in close to 500 bytes of data to be written)
F 0 //flush the file

However, at the point of the F 0 command, the Alfat module returns the error code 0x3.
The SD card is not write protected. Strangely, this problem only occurs when opening the file in append mode, not when initially creating the file.

Does anyone have any idea why this is occuring? Or does anyone know under what conditions the Flush File command returns an 0x3 error code?

Thanks for your help,
Fabian

@ elexon123 -

What version are you using?

I just tried on 1.0.8 and could not reproduce the problem.

Everything is fine and data exist on SD correctly. I am using UART but this is ALFAt command so there is no different between SPI or UART

[quote]
W 0>64 (64 bytes of data)[/quote]

Actually it requires 0x64 = 100 bytes

Hi.
Thanks for your reply.
My mistake with the example, it is actually 100 bytes of data.
I am using 1.0.8 of the Alfat module (on the alfat OEM board).

It does seem fine most of the time, but when I send multiple writes in a row followed by the Flush File command it returns 0x3. If I then attempt the Flush File command again, it keeps returning 0x3 from then on until I restart the device, or unmount the drive.

Would you be able to tell me under what conditions the Flush File command returns a 0x3 error code. There might be a subtle thing wrong with my code that I might have a chance of finding if I knew under what conditions an 0x3 return code is generated.

Thanks for your help,
Fabian