0

I am using STM32, FATFS, SDMMC, eMMC and have created the FATFS on the eMMC. I have also created a FATFS volume on the USBH (host mode). This also works fine.

The eMMC FATFS work fine then I need to copy all files from the eMMC to the USB drive. The copy file by file from eMMC via FATFS is taking too long.

I think it would be faster if I just blindly copy memory block by block (512 bytes) from eMMC to USBH. So I implemented enough routine to do so. The problem is the copy failed after about few hundred block copied. The failure is seemed to be due to the USBH does not respond.

My question is: 1- "Is is possible to copy block by block raw data from eMMC to USBH like I try to do?" 2- have anyone successfully doing so?

1 Answers1

0

Yes it is perfectly normal to blindly copy all the blocks of one storage device to another and to expect it to work.

The only catch is that the devices have to either have the same block size, or else you have to at least pretend they do (eg: treat each 4kB physical block as eight 512-byte blocks). This is because many filesystem drivers always assume the block size is 512 bytes.

One other problem I have encountered in doing this is that devices can overheat (but this isn't a software problem).

Tom V
  • 4,827
  • 2
  • 5
  • 22
  • Thanks Tom! Yes, both USB and eMMC has block size as 512 bytes. So I think it is OK. At first, I am worry about the bad sectors, the 2 devices might have different bad sector . But I did some digging and understand that, the reason it called "logic unit" because the device has it own mapping and to outside world they are all consecutive sectors. – T. Pham May 25 '21 at 19:25
  • Yes both those devices will need to perform wear-levelling so they can map out bad blocks at the same time for little extra overhead. – Tom V May 25 '21 at 21:06
  • If this solves your question can you please accept the answer with the tick mark on the left? – Tom V May 25 '21 at 21:06