Rock3/dev/Enable USB Mass Storage gadget in Linux
ROCK 3 > Development > USB Mass Storage
Contents
Description
This guide describes how to setup USB Mass Storage on Radxa E25.
Requirement
- Radxa E25
- Host PC with Ubuntu or Windows
- USB 3.0 Male A to C or USB C to C cable
- The USB cable is used for powering the Radxa E25 as well as data transmission from your host PC to the Zero. Depends on the USB port on host PC, you may need USB A to C(host PC is USB A) or USB C to C(host PC is USB C) cable.
- Mouse, monitor and HDMI Cable
- To access Radxa E25
- USB to TTL serial cable
- To access Radxa E25
Enable USB mass storage on Radxa E25
Step 1: Disable amlogic-adbd service. It will interfere with USB mass storage mode:
rock@radxa-e25:~$ sudo systemctl disable rockchip-adbd
Step 2: Reboot the device:
rock@radxa-e25:~$ sudo reboot
Step 3: Create a file backing for mass storage, and format it in FAT32:
rock@radxa-e25:~$ sudo dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress # Create a 512M file as /home/rock/share rock@radxa-e25:~$ sudo apt-get install dosfstools # dosfstools contains mkfs.fat rock@radxa-e25:~$ sudo mkfs.fat /home/rock/share -F 32 -I
Step 4: Enable USB mass storage on our backing file and create test.txt file:
rock@radxa-e25:~$ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1 rock@radxa-e25:~$ sudo mount /home/rock/share /mnt/ rock@radxa-e25:~$ sudo touch /mnt/test.txt rock@radxa-e25:~$ echo "hello radxa" | sudo tee /mnt/test.txt hello radxa rock@radxa-e25:~$ cat /mnt/test.txt hello radxa
Accessing storage device from PC
After executing command sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1
on Radxa E25, a new USB storage device will be detected on your host computer: