strange behaviour of mfs in mqx4.2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

strange behaviour of mfs in mqx4.2

1,677 Views
emanueletrapani
Contributor III

hi, i work on cw10.6, frdmk64f, i migrated my application from MQX 4.1 to MQX 4.2.

my application work better on mqx 4.2. i use the sd where i create folders and files. i see a strange behaviour of mfs: in some device i seen that mfs created random some folders in root directory with a strange name like as :"FEOEJEBCNFAEDCACACACACACACA" or strange symbol that i cannot copy here.

someone know why it happens?

thanks

0 Kudos
18 Replies

1,107 Views
reinhardgrauli
Contributor I

Hi,

I've found a problem with sdcard when it's formatted with 4k cluster size. All files are shown in the directory list, but only a few are accessable. Most of them are 'not found'. You can read and write, create files ...

Formatting the sdcard (4GB) with 8k or greater clustersize works fine.

any bugs like that in other applications? I'm using MQX4.2 (4.1) on a k63 mcu.

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

Are you formatting the SD card on a PC or in the MCU with Shell command? What format are you using? FAT, FAT32... ?

Regards,

Carlos

0 Kudos

1,107 Views
reinhardgrauli
Contributor I

Hi Carlos,

I formatted
the SD Cards on a PC and copied all files and dirs from the PC on the Cards.
Formating with FAT32. Clustersize up to 4096 gives strange faults. Above
beginning with 8192 seems ok. In fault cases you can create files and access
them without any error. All files are seen in ‘dir’ listing command. But open
of some files gives the msg: file not found. This is the same in shell / ftp or
application use.

It is not
possible to rename or delete those files. I think it must be something wrong in
the FAT….


Reinhard

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

I got a 4GB microSD card and formatted with FAT32 and 4096 cluster size. I am running tests with the following project:

C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard\build\cw10gcc\mfs_sdcard_frdmk64f

At this point I see no issues. Can you please clarify this? "But open of some files gives the msg: file not found."

How ore you opening these files to cause the error?

Please note that I am using MQX4.2 and FRDM-K64. I would recommend to run tests with different SD cards and move to MQX4.2.

Regards,

Carlos

0 Kudos

1,107 Views
reinhardgrauli
Contributor I

Hi Carlos,

I'd like to give you my SDCard image. But there are coustomer files on it, therfore I don't want to give them free for public use. How can I send them to you?

Regards,

Reinhard

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

I received your files and I am still not able to see the issue, please see what I did.

- Formatted 4GB microSD card with FAT32 and 4096 cluster size

- Copied .zip file into microSD card

- Extracted content of zip file in the same card

- Put microSD card in FRDM-K64 slot

- Ran project in C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard\build\cw10gcc\mfs_sdcard_frdmk64f

- Changed directory to a:\SD_SNR_110\GRAFIK

- Executed 'read' command with different files.

Can you please try this steps with the example project and a different SD card and let me know if you can see the same issue?

If you can please let me know the steps to reproduce it.

Best regards,

Carlos

0 Kudos

1,107 Views
reinhardgrauli
Contributor I

Hi Carlos,

SD_SNR_110 should not be a folder - it's the name of the card. Please delete this folder. 'dir' command should give a result like this:

dir

LOG                 0 08-18-2014 15:09:40     DA LOG

BILDER              0 02-05-2016 14:13:18     DA BILDER

DATEN               0 02-05-2016 14:13:22     DA DATEN

GRAFIK              0 02-05-2016 14:13:24     DA GRAFIK

Here the reaction of the app:

Bitmap: a:/grafik/operation_icon.bmp nicht gefunden (not found)

Bitmap: a:/grafik/programm_icon.bmp nicht gefunden

Bitmap: a:/grafik/setup_icon.bmp nicht gefunden

Bitmap: a:/grafik/thump_up_left.bmp nicht gefunden

That's what shell commands response:

shell> cd grafik

shell> dir operation_icon.bmp

OPERAT~2.BMP      398 02-04-2016 13:41:40      A operation_icon.bmp

shell> read operation_icon.bmp

Error, unable to open file operation_icon.bmp.

Regards

Reinhard

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

have you tested a different SD card?

0 Kudos

1,107 Views
reinhardgrauli
Contributor I

Hi Carlos,

I tested different cards and always I found the same: formatted with clustersize lower or equal 4096 the operation looks like the same. The while - loop in MFS_scan_dir_chain() finished without getting found (error = MFS_FILE_NOT_FOUND). But I think the break is reached before all entries are compared! Sorry, but I'm not so familar with FAT and there are a lot of

'dir_entry_ptr->NAME' entries that are no real filenames. May be that break condition that finishs here is not correct?

Regards

Reinhard

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Reinhard,

Walking through a directory chain might access extra sector, in particular this caused difficulties for long filenames spanning across cluster boundary. have you installed MQX 4.2.0.1 patch? This patch should fix this problem.


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

It is being complicated as I cannot reproduce the behavior. But I still have a couple of thoughts.

1) Debug simultaneuosly two different sessions. One with a good SD card and the other with a bad SD card? Once you reach function MFS_Open_file() compare the file path to check if it is the same. And if it is debug step by step to verify where it gets corrupted.

2) Another problem could be the order in which files are written in SD card causing defragmentation of files. In this case a file which is divided in 2 different clusters could be causing the error. You can try writing files and folders manually one by one... (Not all but most of them) and try again to see if the same file still fails.

Best regards,

Carlos

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

I set it as you said and I am still not able to see the problem. Please see below.

pastedImage_0.png

You can set a breakpoint in function MFS_HANDLE_PTR MFS_Open_file() located in mfs_open.c located in mfs library source code and debug this function to see where is the error happening.

I strongly recommend with a different CD card, I wonder if a sector is damaged. Once you run the test please let me know your findings.

Regards,

Carlos

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Reinhard,

If you want to send it it would be necessary to upload to a FTP server. We use one but you would have access only to download files, not to upload.

An option for you could be WeTransfer

Please note that the limit is 2GB. My email is Carlos.Musich@nxp.com

Regards,

Carlos

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Emanuele,

I don't see this behavior with the example project (C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard\build\cw10gcc\mfs_sdcard_frdmk64f)

What kind of SD card are you using?

Does this happen with any SD card or just some specific?

Can you share the project where this behavior is present? If you prefer not to share a project you may submit a private question at www.nxp.com/support > Submit New issues > Hardware and Software

Regards,

Carlos

0 Kudos

1,107 Views
thiagow
Contributor III

I've a strange behavior using sdcard.c example in my own custom board. Using Kingston sdcard all its ok, but using Sandisk brand the MFS can't initialize the filesystem.

See this topic: MFS bug when using another brands of sdcard? Impedance control, noise?

0 Kudos

1,107 Views
emanueletrapani
Contributor III

i use Kingston micro SDHC of 8GB. i use just this so i cannot say if the problem exist with other SD.

here i can tell that the in my application i often use this code

<< error_code=ioctl(filesystem_handle,IO_IOCTL_CREATE_SUBDIR,(uint32_t *)subdir_name); >>

or like as

<< error_code=ioctl(filesystem_handle,IO_IOCTL_CREATE_SUBDIR,(uint32_t *)"\\config"); >>

where in "subdir_name" there are a string of char. The subdirectory may be preexistent.

But it is not a sistematic behaviour. It not happens always or for each reset of the device.

0 Kudos

1,107 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Emanuele,

I am trying to help, but it would be difficult for us if there is no a way to see the problem in our side.

Can you please use the project mentioned above (C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard\build\cw10gcc\mfs_sdcard_frdmk64f) and run tests with different SD cards to see if you can see the same behavior so we can try to reproduce it on our side?

Regards,

Carlos

0 Kudos

1,107 Views
emanueletrapani
Contributor III

ok, during my test i try to get more info about it.

0 Kudos