AnsweredAssumed Answered

The question about MFS in the MQX

Question asked by Robin Zou on Jun 10, 2015
Latest reply on Jun 10, 2015 by Radek Sestak

              

1.The file “data.txt” is  created in the SD card the windows 7. The address is E:\ data.txt

              

2.The SD card is inserted to the TWRK64F120M.

 

The example C:\Freescale\Freescale_MQX_4_1_TWRK64F120M\mfs\examples\sdcard\build\iar\mfs_sdcard_twrk64f120m

is used to access the file “data.txt”.

 

The source code is shown below and the red part is the one to access file data.txt.

            

                    filesystem_handle = fopen(filesystem_name, NULL);
                    error_code = ferror(filesystem_handle);
                    if (error_code == MFS_NOT_A_DOS_DISK)
                    {
                        printf("NOT A DOS DISK! You must format to continue.\n");
                    }
                    else if (error_code != MFS_NO_ERROR)
                    {
                        printf("Error opening filesystem: %s\n", MFS_Error_text((uint32_t)error_code));
                        continue;
                    }
                   
                   
                    if(filesystem_handle!=NULL)
                    {printf ("SD card installed to %s\n", filesystem_name);}
                    if (readonly)
                    {
                        printf ("SD card is locked (read only).\n");
                    }
                          
                    userfile_ini=fopen("a:\\data.txt", NULL);

 

The a: is installed successfully.The userfile_ini is always is null.The data.txt can not be openned.

 

What is the resason?

 

Remark: The hardware is K64 and the OS is Freescale_MQX_4_1_TWRK64F120M.

               The SD card is  kingston 4G. File system is FAT32.

Outcomes