Problems Copying USB to SD using MFS and MQX4.0

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems Copying USB to SD using MFS and MQX4.0

4,147件の閲覧回数
mrupp_viatechno
Contributor III

I have K70 system running MQX4.0 with both an USB and SD card interface.  When using the shell (Shell_Copy) to copy files from the USB card to the SD card, they become corrupt.  Copying from SD to USB is not a problem.  Attachment is sample corrupt file.  The only thing I tried was to increase the shell task's stack size (from 12,000 to 50,000).  

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

3,840件の閲覧回数
mrupp_viatechno
Contributor III

We wrote our own copy routine that:

1. Opens (fopen) a 'from' and 'to' file

2. using freads() and fwrites(), copies one file to the other

3. Closes (fclose) both files

Like 'Shell_copy' the hand written copy routine does not function when copying from a USB card to an SD card.  

By printing out the 'copied' data we determined that it is the fread() that fails (i.e. it just returns bad data).

More investigation showed that the first fread() always returns good data but each subsequent ones return bad data.  

0 件の賞賛
返信

3,840件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

From your description, it seems a MFS issue. I suggest you upgrade to MQX 4.2.0, patched with the latest patch 4.2.0.2. We made some improvements in MFS in this version. I think it may solved your issues.

Regards

Daniel

0 件の賞賛
返信

3,840件の閲覧回数
mrupp_viatechno
Contributor III

The solution was to use our implementation of the 'Shell-copy' and to locate the read buffer in SRAM (not DRAM).  Locating the read buffer in SRAM was the key.  

0 件の賞賛
返信

3,840件の閲覧回数
mrupp_viatechno
Contributor III

It is a custom board.  MQX can write to the SD card...it's the data that is corrupt.  Not all the file just parts of it.  Open the attachment and you can see that the copied file is mostly correct.

0 件の賞賛
返信

3,840件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

Do you use TWR-K70 board or your custom board?

I suggest you first check whether SD card is write protected or not.

Regards

Daniel

0 件の賞賛
返信