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,