How to Format and Partition an SD Card Larger Than 32GB Using DiskPart in Windows® for MPU

Last modified by Microchip on 2024/10/30 13:55

Introduction

To format and partition an SD card larger than 32 GB using DiskPart in Windows® for use with a Microcontroller Processing Unit (MPU), you need to ensure the file system is compatible with your MPU, such as FAT32. This guide will walk you through the necessary steps to prepare your SD card, ensuring it is correctly formatted and partitioned for optimal performance with your MPU.

Create Image File

In this section, you will partition the SD memory card for 4 MB and format it with the FAT file system using Windows utilities DiskPart and Win32 Disk Imager. Second, you will copy the boot.bin and harmony.bin images to the SD memory card. 

Partition SD Memory Card with DiskPart Utility

DiskPart requires admin privileges.

The Windows Disk Management utility is unable to partition a volume to 4 MB (8 MB is the minimum), therefore we must use the DiskPart utility.

Insert SD memory card into your computer.

Back to Top


Open the DiskPart utility from the Windows search bar or command window.

Type the "​​​​​​list disk" command​​​.

Observe the listing of disk drives on your computer. Identify the SD memory card. In the screen capture below, Disk 0 is the main disk and Disk 1 is the SD memory card.

Tip: Remove all removable memory from your computer to make it easier to identify the SD memory card.

Command Window; Diskpart list command

Type the "​​​​​​select disk n"​​​​​​ command where "n" is the SD memory card.

Be sure to select the SD memory card disk! The operations you type from here on out will be on the disk you select.

Command Window; Diskpart select disk

Type the "​​​​​​list partition" command.

Observe the partitions on the SD memory card. Identify the partition(s).

Command Window; Diskpart list partition command

Type the "​​​​​​select partition n" command where “n” is the partition to be deleted.

Select the partition to be deleted so that you can create a new partition in the next steps.

Command Window; Diskpart select partition command

Type the "delete partition" command.

The selected partition will be deleted.

Command Window; Diskpart delete partition command

Type the "create partition primary size=4" command.

Command Window; Diskpart create partition primary command

Back to Top


Format the SD memory card 4 MB partition.

You may format the SD memory card using a method that is most comfortable to you. Format in either the FAT or FAT32 file system.

The DiskPart command below will format the partition in the FAT file system:

Type the "​​​​​format" command.

Command Window; Diskpart format command

Back to Top


Copy boot.bin and harmony.bin to the 4 MB SD memory card partition you just created.

Back to Top