MFS space limitation on SD cards?

Showing results for 
Search instead for 
Did you mean: 

MFS space limitation on SD cards?

Contributor III

We borrowed (copied/modified) the SD card example in KSDK and got MFS working on an SD card (thank you Freescale for the most robust enablement on the planet).

We've grown our funcionality to include reading and writing files to the SD card and it works well.

But we have a (very consistent) problem when approx 1.9 GB has been written to the SD card (after a fresh windows format) where files can no longer be written, opened, ioctl, read or anything.

It appears that if we delete files from the SD card, we can resume reading/writing/opening files just fine until space fills again.

We think it has to do with the partition manager (limit) but reading around does not tell us that is the real problem.

We've considered removing the partition manager (our reading suggests it isn't needed but we admit we haven't read enough).

But removing the partition manager causes other problems.

And it looks like MFS wants the sector size to be 512 bytes but windows only allows 8k, 16k, or 32k).

Where to turn? Any help is very much appreciated!

PS: KSDK 1.3, KSD 3.2, K65 (tower and custom target board)

PPS: SD card is a 32 GB card, quick formatted as 27.9 GB

Tags (2)
0 Kudos
2 Replies

Contributor V


Have you looked at my post _io_part_mgr_write fails on large sector.

It sounds like a similar problem and I have suggested a fix to the KSDK in that post.

Best regards,


0 Kudos

Specialist V


What is the size of the card and the size of the FAT that is configured when formatted?
Check also the routine that allocates more clusters to see whether it returns a failure - there is a limit when the FAT clusters are used up, which will not allow further data to be written to a file or further objects created.

I have utFAT running on a KEA128 next to me which allows good monitoring and analysis, as shown below (on command line interface), so I expect you will have something similar to see the SD card formatting details and analyse objects etc. which may give some ideas.



Hello, world... FRDM-KEAZ128Q80 [Power-on]
Static memory = 0x00004000
OS Heap use = 0x0225 from 0x2000
Initial stack margin 0x00000000
SD-card V2 - High Capacity

Disk D mounted

Serial number: 00
Software version V1.4.012
Device identification: KINETIS

Main menu
1 Configure LAN interface
2 Configure serial interface
3 Go to I/O menu
4 Go to administration menu
5 Go to overview/statistics menu
6 Go to USB menu
7 Go to I2C menu
8 Go to utFAT disk interface
9 FTP/TELNET commands
a CAN commands
help Display menu specific help
quit Leave command mode

Disk interface
up go to main menu
info utFAT/card info
dir [path] show directory content
dird [path] show deleted directory content
dirh [path] show hidden content
infof [path] show file info
infod [path] show deleted info
cd [path] change dir. (.. for up)
file [path] new empty file
write [path] test write to file
mkdir new empty dir
rename [from] [to] rename
trunc truncate to [length] [path]
hide [path] file/dir to hide
unhide [path] file/dir to un-hide
prot [path] file/dir to write-protect
unprot [path] file/dir to un-protet
print [path] print file content
del [path] delete file or dir.
undel undelete [name]
format [-16/12] [label] format (unformatted) disk
fformat [-16/12] [label] full format (unformatted) disk
re-format [-16/12] [label] reformat disk!!!!!
re-fformat [-16/12] [label] full reformat disk!!!!!
sect [hex no.] display sector
help Display menu specific help
quit Leave command mode


Disk CARD (4124049408 bytes) SDHC FAT32
Bytes per sector: 512
Cluster size: 4096
Directory base: 0x00000002
FAT start: 0x0000005f
FAT size: 0x00001eb3
Number of FATs: 2
LBA: 0x00003dc5
Total clusters: 0x000f5547
Info sect: 0x00000040
Free clusters: 0x000f5545
Next free: 0x00000004
CSD: 0x40 0x0e 0x00 0x32 0x5b 0x59 0x00 0x00 0x1e 0xb9 0x7f 0x80 0x0a 0x40 0x00 0xc7

Directory D:\

---A 26.10.2015 12:00 669752 software.bin
1 files with 669752 bytes
0 directories, 4115943424 bytes free

infof software.bin
File: software.bin is LFN
Starting at entry 0x01 in sector 0x00003dc5 (cluster 0x00000002)
First object from 1
Data = 0x41 0x73 0x00 0x6f 0x00 0x66 0x00 0x74 0x00 0x77 0x00 0x0f 0x00 0xed 0x61 0x00 0x72 0x00 0x65 0x00 0x2e 0x00 0x62 0x00 0x69 0x00 0x00 0x00 0x6e 0x00 0x00 0x00
SFN File located at entry 0x02 in sector 0x00003dc5 (cluster 0x00000002)
Data = 0x20 0x00 0x09 0x00 0x03 0x08 0x1e 0x18 0x2f 0x00 0x00 0x20 0x00 0x00 0x00 0x60 0x5a 0x47 0x5a 0x47 0x00 0x00 0x00 0x60 0x5a 0x47 0x03 0x00 0x38 0x38 0x0a 0x00
SFN name (archive) = ......./.. Alias CS = 0xed
File length = 669752 starting in sector 0x00003dcd (cluster 0x00000003) FAT sector 0x0000005f offset 0x03

0 Kudos