SAM-BA® ISP - Applets: Program High-Speed Multimedia Card Interface (HSMCIx) or Secure Digital Multi-Media Card (SDMMCx)

Program High-Speed Multimedia Card Interface (HSMCIx) or Secure Digital Multi-Media Card (SDMMCx) (sdmcc)

The sdmcc applet initializes the High-Speed Multimedia Card (HSMCIx) or the Secure Digital Multi-Media Card (SDMMCx) Interfaces and can perform read, write, and verify functions of an external Secure Digital (SD) Memory Card or Embedded Multi-Media Card (e.MMC) memory embedded on the target board.

The sdmcc applet applies to the following devices. Documentation is available in the ../sam-ba/doc/ directory.

Device Documentation
SAM9X60 ../doc/sam9x60.html
SAMA5D2 Series ../doc/sama5d2.html
SAMA5D3 ../doc/sama5d3.html
SAMA5D4 ../doc/sama5d4.html

Additional documentation is located in the document directory: ../doc/sdmmc.html.

sdmmc Command Structure

The sdmcc applet has the following command structure:

$ sam-ba -p <port> -d <device> -a sdmmc -c <command>

Initialize Controller

Initialization of the sdmcc applet has the following command:

$ sam-ba -p <port> -d <device> -a sdmmc

A list of parameters to initialize the sdmcc applet can be displayed with the help option (using the SAMA5D2 Series device as an example):

$ sam-ba -p serial -d sama5d2 -a sdmmc:help

Syntax: sdmmc:[<instance>]:[<ioset>]:[<partition>]:[<bus_width>]:[<voltages>]
Parameters:
    instance   SDMMC controller number
    ioset      SDMMC I/O set
    partition  Partition number (0=user partition, x>0=boot partition x)
    bus_width  Data bus width (0=controller max, 1=1-bit, 4=4-bit, 8=8-bit)
    voltages   Supported voltages (bitfield: 1=1.8V, 2=3.0V, 4=3.3V)
Examples:
    sdmmc           use default board settings
    sdmmc:0:1:1:8:5 use fully custom settings (SDMMC0, IOSET1, first boot partition, 8-bit, 1.8V/3.3V)
    sdmmc:0::1      use default board settings but force use of SDMMC0, first boot partition

A list of parameters is located in the document directory: ../doc/sdmmc.html.

Supported Commands

A list of commands supported by the sdmcc controller can be displayed with the following command:

$ sam-ba -p <port> -d <device> -a sdmcc -c help

read Command

The read command reads data from SD Memory Card or e.MMC memory into a binary file.

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c read:help

* read - read from memory to a file
Syntax:
    read:<filename>:[<addr>]:[<length>]
Examples:
    read:firmware.bin              read all to firmware.bin
    read:firmware.bin:0x1000       read from 0x1000 to end into firmware.bin
    read:firmware.bin:0x1000:1024  read 1024 bytes from 0x1000 into firmware.bin
    read:firmware.bin::1024        read 1024 bytes from start of memory into firmware.bin

write and writeboot Command

The write and writeboot commands write data from a binary file into the SD Memory Card or e.MMC memory.

The blocks containing the pages to be written should be erased first with the erase command.

The write command should only be used to write a binary image (sdcard.img) into either an SD Memory Card or an e.MMC memory user partition.

The sdcard.img file contains the raw data of the SD Memory Card. It must begin with a Master Boot Record (MBR), a valid partition table, and contain two partitions:

The first partition (BOOT) must be formatted in FAT12, FAT16, or FAT32 and it must include a boot.bin file in the root folder. The boot.bin file is the second stage bootloader (at91bootstrap) that is loaded and executed by the ROM Boot code.

The second partition (ROOTFS) must be formatted in EXT2 or EXT4 and include the Root File System.

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c write:help

* write - write to memory from a file
Syntax:
    write:<filename>:[<addr>]
Examples:
    write:sdcard.img            write sdcard.img to start of memory

The writeboot command should only be used when programming a bootstrap file into an e.MMC memory boot partition.

The writeboot command modifies the relevant unused ARM exception vector to store the size of the bootstrap binary, as required by the ROM Boot code during the boot process.

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c writeboot:help

Syntax:
    writeboot:<filename>
Example:
    writeboot:bootstrap.bin     write bootstrap.bin as boot program at start of memory

verify and verifyboot Command

The verify and verifyboot commands compare the data written into the SD Memory Card or e.MMC memory with the contents of a binary file.

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c verify:help

* verify - verify memory from a file
Syntax:
    verify:<filename>:[<addr>]
Examples:
    verify:sdcard.img           verify that start of memory matches sdcard.img
    verify:firmware.bin:0x1000  verify that memory at offset 0x1000 matches firmware.bin

The verifyboot command ignores the relevant unused ARM exception vector in the binary file.

$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c verifyboot:help

* verifyboot - verify boot program from a file
Syntax:
    verifyboot:<filename>
Example:
    verifyboot:bootstrap.bin     verify that start of memory matches boot program bootstrap.bin
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.