I’m having a hard time figuring out how to do this. Here is my code, could you tell me what is wrong with it? ffconfigMAX_PARTITIONS is set to 2, and the 2nd call to FF_Format is only finding 1 partition when it calls FF_PartitionSearch.
PS. please check all return codes from the library calls and it may also useful to define FF_PRINTF, in order to see the internal logging of FreeRTOS+FAT.
I’m still playing with it and I’ll report later.
Hi Michael, the biggest problem with your code was this line:
partitions.ulHiddenSectors = 0;
As a consequence, the boot sector 0 got overwritten while formatting partition 0.
The meaning of partitions.ulHiddenSectors is: the offset where the BPR ( Partition Boot Record ) shall be stored.
I will add a configASSERT(), to flag this off in future releases.
There were some other issues, like not settings the signature:
pxDisks[ i ]->ulSignature = sdSIGNATURE;
As multiple partitions are rarely used, the documentation about this feature is maybe not optimal. We’re sorry about this.
Here below you find an attachment called format_partitions.c that I used for testing.
This is the amount of cache memory per I/O handler. Recently there was a question about the “optimal” size of this cache memory. I found that at most 9 sector buffers were being used simultaneously in a busy application:
I’ve incorporated your suggestions and am now successfully partitioning my SD card. But now my problem is that Windows won’t read the second partition. I can see it through the disk management console, but I can’t actually access it. Apparently (and I wish I’d known this before) Windows just doesn’t recognize multiple partitions on a removable drive. I found a couple workarounds that involved installing a hacked-together driver to make windows see it as a non-removable drive, but only ended up causing Windows to run its “Repair Windows” utility upon restarting and re-install the old driver.
Do you have any other suggestions for accessing the second partition?
Linux might be an option if I were the user of my product. Unfortunately, I need to make it work for Windows users.
My original question was whether I’d be able to access all partitions from Windows. Apparently the answer should have been “no.” I understand now that this limitation is inherent in Windows.
Hello - I’m trying to understand how to create multiple partitions on a single RAMdisk for testing purposes (eventually will be using eMMC) - is the “format_partitions.c” file still available somewhere for reference?
The description of the FF_Partition() API seems to suggest that a singular physical media described by a singular FF_Disk_t structure would be divided into a number of partitions as described by the FF_PartitionParameters structure. However, this post leads me to believe that a separate FF_Disk_t structure is needed for each partition, which seems counterintuitive. An example showing how to give a single RAMdisk two partitions would be very helpful. Thanks!