Petit FatFs is a sub-set of FatFs module for tiny 8-bit microcontrollers. It is written in compliance with ANSI C and completely separated from the disk I/O layer. It can be incorporated into the tiny microcontrollers with limited memory even if the RAM size is less than sector size. Also full featured FAT file system module is available here.
Fascinating little project.
Sweet, projects like this brighten my day!
I have used Petite FatFs, and it’s bigger sibling FatFs on multiple projects. It is a solid library and works well. For a long time (and may still be) it was the only non GPL cross platform FAT library for 8 bit systems. Petite FatFs can be a bit finicky about what cards it supports in my experience, but it is solid and works well
Me too. They’re both great for low-end embedded systems, like old game consoles. I’ve not seen an issue with PetiteFS on SD cards – it’s the disk interface that needs to handle the difference in cards rather than the FS.
I am not sure how else to describe it, but I took Elm Chan’s disk interface code for SPI SD cards, and fount about 1/4th of my cards wouldn’t work with it — I tried about 20. Identical code with FatFs didn’t seem to show the same issue, nor did mBed’s SD FAT library. YMMV.
Thankfully I only needed to make 5, and have two back up cards per device for the client so it worked fine.
Maybe it had to do with the way those cards were formatted. It’s possible it had trouble with an odd partitioning. I’ve never run into that, but it’s possible you had weirdly partitioned cards.
Was the disk driver part the same for PFS and FatFS/SD FAT lib? If not, it’s possible it was still a card issue rather than a filesystem issue. There are issues with certain older SD cards that might not be addressed in the driver used with the PFS simply because it’s meant for a smaller system, so they didn’t “waste” the space on something only affecting a handful of cards.
The driver was the same, and I tried reformatting the drives as FAT12 and FAT16 using three different OSs.
And as for your statement:
Wouldn’t that agree with my assessment that “Petite FatFs can be a bit finicky about what cards it supports”?
@jockm
If the issue is in the disk driver part, then it’s not actually PetiteFS’s fault as that must be written by the person using PFS in their project. It was my responsibility to handle the “odd” cards as part of my driver code, with no changes at all to PetiteFS itself. Anywho, without knowing more about the system in question, the driver code part, and the cards that failed, it’s difficult to assign blame to where it should go.
I did notice you mentioned formatting as FAT12 and FAT16 – these must be positively ancient drives to be so tiny as to be formatted as anything other than FAT32. Did you try them as FAT32? It is possible that there’s a problem in PFS with FAT12 or FAT16 under some cases… I don’t think I’ve seen a FAT12 or FAT16 disk since moving away from floppies. I’ve done all my testing on FAT32, so I’ll admit that I can’t verify PFS on FAT12/FAT16. It was never something I had to deal with.
OMG yes, please assume that I have tried every format, partition table, OS doing the formatting, etc. I think I have provided enough information for you to assume I did that. I tried FAT12 and FAT16 deliberately to see if it made a difference. The cards were of varying ages and sizes, no there was no discernable reason why some were accepted and some were not.
But you keep missing something: Both FatFs and PetiteFs are written by the same person, if FatFs works with some drives and PetiteFs doesn’t using the exact same drive interface code… that was provided by the author… then it is the library.
I am done replying to this