Over a million developers have joined DZone.

Multi-Drive Support with FatFS

DZone's Guide to

Multi-Drive Support with FatFS

· IoT Zone
Free Resource

Cisco IoT makes digital transformation a reality in factories, transportation, and utilities. Learn how to start integrating with Cisco DevNet.

I 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)

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’:

FatFS with List of drives

FatFS with 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:

Increasing the number of drives

Increasing the number of drives

Note that you need to increase the number of volumes to match the number of drives:

Number of Volumes in FatFS

Number of Volumes in FatFS

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:

Continue reading...




Cisco is a software company. Surprised? Don’t be. Join DevNet to explore APIs, tools, and techniques that developers are using to add collaboration, IoT, security, network priority, and more!


Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}