Multi-Drive Support with FatFS
Join the DZone community and get the full member experience.
Join For Freei admit: i’m sometimes a lazy person. in my projects, i only needed one ‘disk drive’ with the fatfs processor expert component : either a sd card or a usb msd drive. but a reader of my blog wanted to use fatfs with multiple drives: using it with an sd card and a usb msd drive. and actually fatfs does support this, i just had no need for it, thus i did not add anything special for it. but that reader let me think that i better add multi-drive support. even if i do not need it now, that could be very handy in the future :-)
fatfs drive system (source http://elm-chan.org/fsw/ff/en/appnote.html )
multi-drive support with the fatfs component
the way how processor expert components are implemented made it pretty easy to extend the existing fatfs component from using a single drive to a ‘multi-drive component’: instead linking to a single ‘memory’ or ‘drive’ component, i changed the interface to use a ‘list of drives’:
list of drives
i can now increase or increase that list of drives: the screenshot below shows an sd card and a usb msd drive in the list:
note that you need to increase the number of volumes to match the number of drives:
what might be somewhat confusing is how ‘drive’ and ‘volumes’ are related: by default each drive has a single volume, which means there is a single partition per drive. this is set by the _multi_partition setting in fatfs:
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
How to Submit a Post to DZone
-
DZone's Article Submission Guidelines
-
Is Podman a Drop-In Replacement for Docker?
-
Microservices With Apache Camel and Quarkus
Comments