IoTGateway/BSP/Android/Gettingstarted/How to use SD/MMC Card for rk

From ESS-WIKI
Jump to: navigation, search

Browse the SD

Android 6 Marshmallow also includes a built-in file manager feature to browse the SD card.

  • Launch the Settings app.
  • Tap on Storage & USB.
  • Tap on SD card to explore the files.

RTENOTITLE

RTENOTITLE

RTENOTITLE


External storage (SD/MMC card) is managed by a combination of the vold init service and MountService system service. Mounting of physical external storage volumes is handled by vold, which performs staging operations to prepare the media before exposing it to apps. Please refer to "Device Configuration" section on the Andrid website http://source.android.com/devices/storage/config.html

fstab.device

/devices/ff0c0000.rksdmmc/mmc_host*        auto  auto    defaults        voldmanaged=sdcard1:auto,encryptable=userdata

Check sysfs node

# cat /sys/block/mmcblk0/device/type
MMC
# cat /sys/block/mmcblk1/device/type
SD


SD/MMC Card insertion

The kernel starts scanning once the SD card is inserted and create devices for each partition. 

rk_sdmmc: BOOT   The card is inserted.  ===!!!!!!==[mmc1]
mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, actual 396825HZ div = 63)
rk_sdmmc: BOOT dw_mci_setup_bus: argue clk_mmc workaround out 800000Hz for init[mmc1]
mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
rk_sdmmc: BOOT dw_mci_setup_bus: argue clk_mmc workaround out normal clock [mmc1]
rk_sdmmc: BOOT Bus speed=50000000Hz,Bus width=4bits.[mmc1]
mmc1: new high speed SDHC card at address 1234
mmcblk1: mmc1:1234 SA04G 3.63 GiB
 mmcblk1: p1
FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Write to SD

# dd if=data of=/dev/block/mmcblk1 bs=1 seek=4096

Read from SD

# dd if=/dev/block/mmcblk1 of=data1 bs=1 count=1024 skip=4096