- Fri Apr 16, 2010 7:42 pm
#98723
If you are writing to a fragmented file system you could end up having to scan a lot of the FAT in order to find the next free cluster.
As an example consider what happens if you run into a 10MB file that you have to skip over. On a card with 8K clusters that is 1280 clusters or 5 sectors. In this instance worst case is 6 sector reads and 2 sector writes to allocate a new cluster. Plus all the time spent scanning the sectors. If you don't have sufficient data buffers to cover for this delay then you will drop data.
sebmadgwick wrote: This would also mean that the 250 kB/s you derived in previous post would therefore represent the maximum throughput of a system (with10MHz SPI) capable of dealing with fragmented drives?That depends on what your code does. Plus remember that I ignored all the command overhead and card sector write times. That will cut into the maximum.
If you are writing to a fragmented file system you could end up having to scan a lot of the FAT in order to find the next free cluster.
As an example consider what happens if you run into a 10MB file that you have to skip over. On a card with 8K clusters that is 1280 clusters or 5 sectors. In this instance worst case is 6 sector reads and 2 sector writes to allocate a new cluster. Plus all the time spent scanning the sectors. If you don't have sufficient data buffers to cover for this delay then you will drop data.