Hi Evgeni
I have seen (also from your email) that you are working with an SPI FLASH type which is not included in the uTasker project.
You have thus written also a new SPI driver interface for this type, being multiplexed with another SPI device (FPGA).
This means that it is difficult to say where the problem is and could be in the commands used together with this SPI FLASH type, its new driver code or elsewhere.
1) Are you sure that the basic read/write is operating correctly? If not, there may be basic problems with reading back the length of file which was saved.
2) I would first check which length the file system routine is actually (trying) to save to the SPI FLASH. To do this put a break point in uFileCloseMime() at
if ((fnWriteBytesFlash(ptrFile, (unsigned char *)&Len, sizeof(MAX_FILE_LENGTH))) != 0) { // write the length to the file
Len = 0;
}
Is the value contained in Len 230884 or 310000? What address is ptrFile?
3) When reading the length of the file back, check that the same location is used for the read and then whether the content is as expected.
These first tests may help identify in which area the problem is.
Regards
Mark