FX3S-Fatfs File Copy Issues

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
rasu_4591691
Level 2
Level 2

Hi,

I am using PACTRON'S FX3S FPGA Dev Board REV-C. It has two storage port. I used to copy the file from one sd card to another sd card (both are ex fat sd card) using Fatfs file system. To copy the 512mb file from sd0 to sd1 it will take a time of 2 minutes 6 seconds. I am using 32KB  buffer for FATFS read/write buffer. I need to improve Maximum Speed and to decrease the time.

How can I reduce the time duration of copying the file?

Thanks & Regards

S.Ravi Chandrika

0 Likes
1 Solution

Hi Ravi Chandrika,

I went through the firmware you provided in the thread: SUBJECT: FX3S – SD Card Copy

I understand that you are writing and reading the data in chunks of 32KB using the f_read and f_write functions.

So, could you try and change the size of the buffer variable in the f_read and f_write functions in increments of 1KB and see if it makes any difference and share your findings?

There are limitations with the use of these functions f_read and f_write as they need to make calls to the disk read/ writes through the driver which degrades the throughput.

Regards,

Yashwant

View solution in original post

0 Likes
9 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello,

Can you please what file format are you trying to copy?

Also, can you provide the steps in which you are achieving the 2min 6sec time frame?

Regards,
Yashwant

0 Likes

Hi,

I am using .img format file.

        for (;;)
        {

         rc = f_read(&Fil, &buffer, sizeof buffer, &br);    //file read

         if (rc || br == 0) break;
         rc = f_write(&Fil1, &buffer, br, &bw);             //file write

         if (rc || bw < br) break;
        }

Regards

S.Ravi chandrika

0 Likes
rasu_4591691
Level 2
Level 2

my requirement is within one minute, 1gb file should be copy from one sd card to another sd card.

Regards

S.Ravi Chandrika

0 Likes
rasu_4591691
Level 2
Level 2

Hi,

My previous buffer size is 32000. Now I fix a buffer size 32768. If I fix 32768 ,the time duration reduced. To copy a 512 mb file it will take a time of 77.054 seconds . Now how I reduce my time duration based  on my requirement.

Regards

S.Ravi Chandrika

0 Likes

EDITED:

Hello Ravi Chandrika,

Can you please change the buffer size that you are using to read and write the data in the f_open and f_close functions to 48KB and check if it is as required?

Please do the above and share the results.


Regards,

Yashwant

0 Likes

Hi,

The data memory is already full. so I am not able to increase my buffer size.

Is there any other solution to solve this problem?

Regards

S.Ravi chandrika

0 Likes

Hi Ravi Chandrika,

What do you mean by "the data memory is already full"?

Do you get any error when you try to do what i suggested?

Can you please share the error you get?


Regards,
Yashwant

0 Likes

Hi,

I am getting these errors:

FX3SMassStorage.elf section `.bss' will not fit in region `DATA'

region `DATA' overflowed by 12924 bytes

cs-make: *** [FX3SMassStorage.elf] Error 1

Regards

S.Ravi chandrika

0 Likes

Hi Ravi Chandrika,

I went through the firmware you provided in the thread: SUBJECT: FX3S – SD Card Copy

I understand that you are writing and reading the data in chunks of 32KB using the f_read and f_write functions.

So, could you try and change the size of the buffer variable in the f_read and f_write functions in increments of 1KB and see if it makes any difference and share your findings?

There are limitations with the use of these functions f_read and f_write as they need to make calls to the disk read/ writes through the driver which degrades the throughput.

Regards,

Yashwant

0 Likes