Menu Close

U-Boot EMMC and SD Card Operation Commands

This article talks about the U-Boot EMMC and SD card operation commands that are used most commonly.

For related subjects, please refer to the SOC Table of Contents.

 

Using mmc info

mmc info is mainly used to return the device information of the selected MMC. The command is used directly without any other components.

We can see that the current MMC device is a SD card, with the version number being 3.0, and having a capacity of 14.7 GiB, along with other information.

 

Using mmc rescan

mmc rescan is used to scan MMC devices on the current development board. This includes EMMC and SD cards.

 

Using mmc list

mmc list is used to check the number of MMC devices that are currently connected to the SD card.

We can see that we currently have one MMC device on our development board, which is mmc@e0111111: 0 (SD). Where it is a SD card. Note that SD cards will always be set as the current MMC device by default.

 

Using mmc dev

The mmc dev command is used to change and set the current MMC device. Command formatting is as follows:

mmc dev [dev] [part]

Where dev is used to specify the MMC device to switch to, and part is the partition. If part is left blank, it will default to partition 0.

 

Using mmc part

Note that sometimes SD cards or EMMC may have multiple partitions. We can use mmc part to view all these partitions, but first we will need to make sure we are on the SD card by using the following code:

mmc dev 0

Next, we will use the following code to view the SD card partition.

mmc part

Using mmc read

mmc read is used to read data from MMC devices. The formatting is as follows:

mmc write addr blk# cnt

Where addr is the DRAM starting address of the data you want to write to MMC, blk is the MMC starting address to be written to, and cnt is the size to be written. Note that you should never write to the first two sectors of SD cards or EMMC as it stores important partition data.

 

Using mmc erase

mmc erase is used to erase specified sectors in MMC. The formatting is as follows:

mmc erase blk# cnt 

Where blk is the start of where you want to erase, and cnt is the amount to be erased.

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!