Skip to main content
JCorn.2
Associate III
July 18, 2019
Question

FAT SD card works, FAT32 doesn´t. Why?

  • July 18, 2019
  • 2 replies
  • 1380 views

Hello everybody,

i am using a STM32F401RE nucleo board and have implemented USB as mass storage device and a SD card with SDIO 1 bit mode.

When I am using 2 GB SD card with FAT. Everything works like a charm. Windows shows me the SD card after 1 second and i can access it, create new .txt files and delete them and so on.

When I am using a 16GB SD card with FAT32. Windows needs 45 seconds to show me the SD card. After that everything works fine too, but 45 sec is a long time..... tooo long.....!!!

When I fragement the 16GB SD card to 4GB FAT, everything works fine, even when I format it to 16GB NTFS, windows shows me the SD card after 2 seconds....

Why does the 16GB FAT32 SD card take so much time? Do I need a special library? What have I done wrong? Does STM32 doesn´t support FAT32? Is Windows the problem?

Please help me....

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
July 18, 2019

Probably because a) the FAT Table is huge, and b) your implementation is slow.

NTFS manages free space differently

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
JCorn.2
JCorn.2Author
Associate III
July 18, 2019

Thanks @Community member​  for the fast response !

So there is no way to make it faster?

Windows detects the SD card in FAT32 immediately, but it takes so long to be shown in the explorer, which is pretty annoying.

Tesla DeLorean
Guru
July 18, 2019

>>So there is no way to make it faster?

Check the clock rate you have to the card.

Check the through-put of your code with single and multiple sectors.

Single sector reads/writes will be slow, significant command/response overhead.

Do larger reads? Cache data? Use a wider bus?

The ceiling for USB-FS perhap 600-700 KBps, quantify what you're seeing on the PC side currently.

Instrument your code to understand what's going on, and the interactions that are consuming the most time, or acting unexpectedly.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..