This blog shares several issues reported by China customers when they use NAND FFS in MQX4.1.1.
NAND FFS open failure issue
Customer reported they can use a pressure test code to continuously open file, write file and close file, each time write about 20 bytes with append and they will find after running for a while, file open will fail and it returns error code 0x3067 (MFS_EOF). Each time file open failed, file has been written with 20480 bytes.
This is a typical use case at customer side for data logging. The test code is attached named as "nand_pressure_test.cpp". Attached patch file named "mfs_write.patch" can resolve this issue.
Memory allocation issue when using MFS & NAND FFS
Customer run pressure test for MFS and NAND FFS by creating multiple levels of sub-folders (up to 100 levels) and in each sub-folder they create random number of files (up to 50). For each file, they will write 250 bytes.
They found code failed to open new file when create sub-folders to 41 level.
Traced the code on K70 tower and found actually this is not problem with MFS to search clusters for the new file, instead when the issue occurs, it's the drive_ptr (MFS_DRIVE_STRUCT) which is corrupted when MFS use memory allocation routine to allocate file path.
The pressure test code for this case is attached. File named "MultiLevel_Folder_Test.zip".
The memory corruption for MFS drive info is due to there is no protection in MFS_Parse_pathname() on whether the actual path name used passed from fopen will be exceeding 260 bytes which is fixed in mfs.h file to be compatible with Windows. So need to take care of this internal limitation when handling multiple level folders.
MFS deadlock issue when using NAND FFS
Customer reported random code block issue when running pressure test against NAND FFS. The issue is quite random, sometimes takes 12 hrs to reproduce the issue. Test code attached. Name is "MFS deadlock issue.zip". The resolution and description on this issue is in attached file named "MQX-4919 NandFFS explanation".