Author Topic: SD Card Format Speed  (Read 168 times)

Offline AlexS

  • Newbie
  • *
  • Posts: 33
    • View Profile
SD Card Format Speed
« on: July 13, 2021, 06:47:49 PM »
Hi,

Currently implementing the format function in the product, initial tests show ~6 minutes for formatting an 8GB card. Are there any tips to make it faster? I notice that the fnMassStorage() task is running for around 7ms each iteration.

Thanks!

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3155
    • View Profile
    • uTasker
Re: SD Card Format Speed
« Reply #1 on: July 13, 2021, 07:13:20 PM »
Alex

That is a long time for the formatting to take - I expect maybe 30s or a minute if doing a quick format (which deletes the FAT but not all sectors - a full format (also wiping out old data in the sectors) will take a lot longer.

The mass storage task will be doing this by deleting a sector at a time and the sector writes (setting content to 0) will usually take about 4ms each. Then the task allows other tasks to run and continues with the next, repeating until finished.

What is the time gap between each iteration? Is there something running between each which slows the overall operation?

Ultimately the format time is the sum of the time to erase each sector in the FAT table (whereby there are 2 copies maintained and so the overall time is double) plus any other time added between iterations.

Regards

Mark


Offline AlexS

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: SD Card Format Speed
« Reply #2 on: July 13, 2021, 07:21:52 PM »
1. It takes about 8ms per run of fnMassStorage() task with 4ms in between iterations. This is how I'm starting the format:
Code: [Select]
utFormat(DISK_SDCARD, VOLUME_LABEL_STR, UTFAT_REFORMAT | UTFAT_FORMAT_32)
2. Is there any specific routines that must be called after the format completes?  I'm calling utAllocateDirectory() after detecting that the disk is mounted again and getting '0' returned.

Alex

« Last Edit: July 13, 2021, 07:24:15 PM by AlexS »