is this the fastest way for copiing 2 files? The file to copy has a size of 150 kByte. And my routine needs about 12 seconds (dsPIC 140 MHz). The MicroSD is class4 (4MB/s).
SPI settings:
SPI2_Init_Advanced(_SPI_Master, SPI_8_Bit, _SPI_Prescale_Sec_1, _SPI_Prescale_Pri_4,
_SPI_SS_Disable, _SPI_Data_Sample_Middle, _SPI_CLK_Idle_High, _SPI_Active_32_Idle);
Code: Select all
Mmc_Fat_Init();
file_handle1:=Mmc_Fat_Open(filename1, file_read, 0x01);
file_handle2:=Mmc_Fat_Open(filename2, file_write, 0x80);
Mmc_Fat_Activate(file_handle2);
Mmc_Fat_Rewrite;
Mmc_Fat_Activate(file_handle1)
Mmc_Fat_Reset(file_size);
for i:=0 to 600-1
do begin
Mmc_Fat_ReadN(@buffer1,256);
Mmc_Fat_Activate(file_handle2);
Mmc_Fat_Write(@buffer1,256);
Mmc_Fat_Activate(file_handle1);
end;
Mmc_Fat_Close(); // Close first file
Mmc_Fat_Close(); // Close second file