The phyCORE-AM65x SOM brings out a 4-bit wide MMC data bus to the standard SDHC card slot at X13. Power to the card slot is supplied by inserting the appropriate card into the SD/MMC1 connector, which features card detection. This interface shares a bus with the WiFi module on the SOM, but is available on the development kit as an SD card interface for external media or as a bootable interface.


Step-by-step guide

In order to follow this guide, you will have to boot from the on-board eMMC. See HERE for more information.

When an external SD Card is inserted, it will be available as /dev/mmcblk1 in Linux.

Mount the SD Card

  • Create a temporary directory and mount an SD card partition using the below commands:

Target (Linux)

mkdir /home/root/temp
mount /dev/mmcblk1p1 /home/root/temp
CODE

Write to the SD Card

  • You can use basic Linux commands to create and write files to the SD card. Below is an example:

Target (Linux)

echo "Hello World" > test.txt
cp test.txt /home/root/temp/
CODE

Read from the SD Card

  • To read what was just written to the SD card in the previous example, use the following command:

Target (Linux)

cp /home/root/test.txt read.txt
CODE
  • To check that the read file (read.txt) is the same as the one that was written (test.txt) you can use md5sum to compare and verify the data transfer was successful:

Target (Linux)

md5sum /home/root/test.txt && md5sum read.txt
CODE
  • The above command will generate a long and seemingly random string of characters for both files. This long string is called a "hash" and it uniquely identifies the files. If the hash for both files match then you can be confident that both files (down to each bit) are identical. 

Expected Output

root@am65xx-phycore-kit:~# md5sum /home/root/test.txt && md5sum read.txt
e59ff97941044f85df5297e1c302d260  /home/root/test.txt
e59ff97941044f85df5297e1c302d260  read.txt
CODE

Unmounting the SD Card

  • Before unplugging the device from the development kit, make sure to unmount it in software. You can do this by running the following command:

Target (Linux)

umount /home/root/temp
CODE