Over a million developers have joined DZone.

Multi-Drive Support with FatFS

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

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...




The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.


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

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

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 }}