SDIO Driver
The SDIO (Secure Digital Input/Output) is a universal I/O interface protocol extended from the SD memory card standard, widely used in fields including IoT, consumer electronics, and industrial control.
The JH7110 SoC is equipped with two SDIO interfaces. By default, SDIO0 is used for eMMC, while SDIO1 is reserved for SD cards or peripherals such as Wi-Fi. On the RT-Thread side, SDIO1 is the interface in use.
The RTOS includes an SDIO driver, with its files located at the following paths:
-
rtthread/bsp/starfive/libraries/driver/drv_sdmmc.c
-
rtthread/bsp/starfive/libraries/hal/sdmmc
The following table describes the common operations on SD cards:
| Operation | Command | Description |
|---|---|---|
| Mount SD card to root directory | # mount SDIO1 / elm |
Mounts the SD card to the root directory. |
| Unmount SD card | # umount / |
Unmounts the SD card from the root directory. |
| Copy file to SD card | # cd # echo “12345”
test.txt/ |
Navigates to the root directory, and then creates a file
test.txt with content "12345" (saves to the
mounted SD card). |
| Delete file from SD card | # cd /# rm test.txt
|
Navigates to the root directory, and then deletes the
test.txt file from the SD card. |
| Create sub-directory | # cd /
# mkdir mnt |
Navigates to the root directory, then creates a subdirectory
mnton the SD card. Successful execution
confirms normal device mount/unmount and read/write
functions. |
| Format SD card as FATFS | # mkfs -t elm SDIO1 |
Formats the SD card to the FATFS file system. Execution duration varies based on the SD card’s capacity and speed class. |
