Using SD Card in Linux |
This application note explains how to use SD Card in Linux on the Emcraft Systems i.MX 6ULL System-On-Module (SOM) plugged into the development baseboard (IMX6ULL-SOM-BSB). Support for the SD Card is enabled in the standard rootfs project available from the Emcraft software distribution and installed on each module shipped by Emcraft. Insert a pre-formatted card with an MS-DOS file system to the SD Card slot on the development baseboard. When you boot the uImage on the i.MX 6ULL, there should be messages similar to the ones shown below. In the below example, Linux has detected an SD Card with a single partition on it: ...... [1.731948] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA At this point you are ready to mount the MS-DOS file system on the SD Card. This is done as follows:
Check that the file system has indeed been mounted (refer to the last line in the below output): ~ # mount Now you can write something to the SD Card. In the below example, we store the current date and time to a log file, although in real-life applications you will probably want to do something more meaningful:
Verify the written content by reading the log file back:
Write throughput to an 8GB Kingston SDHC card class 4 is measured to be the following:
Read throughput using the same SDHC card as follows:
Ok, you have validated that we can write data to the SD Card. Now you remove the card from the embedded target. Unmount the file system and then extract the card from the SD Card slot:
At this point, you can take the card to your PC or notebook and process data stored in the MS-DOS filesystem. As a final step in this application note, validate hot insertion of SD Card on the target. Insert the card back into the SD Card slot on the baseboard with Linux up and running on the i.MX 6ULL. Messages similar to the ones shown below should appear on the Linux console:
Mount the MS-DOS file system and verify the content of the previously created log file:
|