RockpiE/dev/usb-mass-storage
ROCK Pi E > Development > USB Mass Storage
Contents
Description
This guide describe how to setup USB Mass Storage OTG on ROCK Pi E.
Requirement
- ROCK Pi E mainboard
- eMMC module
- Power adapter
- USB Male A to Dupont cable.
- One port is Male A type and the other includes three Dupont lines.
- Hardware connection
ROCK Pi E 40-pin Header | USB Interface | USB Male A to Dupont Cable |
---|---|---|
PIN#18 | Data+ | Green wire |
PIN#16 | Data- | White wire |
PIN#14 | GND | Black wire |
Support
Support hardware platform:
- ROCK Pi E V1.1 or later
You'd better follow the installation steps.
Operations on ROCK Pi E
For example, my testing borad is Rock pi E V1.2 on Debian buster, Linux rockpie 4.4.194-19-rockchip-g287ff75afc47
You can use ssh or serial console to access ROCK Pi E.
Step 1: Add the following line to file /boot/uEnv.txt.
overlays=rk3328-uart2 rk3328-usb-otg
Step 2: Update rockchip-overlay, kernel, rockchip-adbd kernel packages.
$ sudo apt-get install -y rockchip-overlay $ sudo apt-get install -y linux-4.4-rock-pi-e-latest
Step 3: Add the following to /etc/modules
$ cat /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. g_mass_storage
Step 4: Reboot the device.
$ sudo reboot
Step 5: Create a file to be a shared space and make it FAT32 type.
$ sudo dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress $ sudo apt-get install dosfstools $ sudo mkfs.fat /piusb.bin -F 32 -I
Step 6: Enable usb mass storage with the file
$ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1 $ sudo mount /home/rock/share /mnt/ $ sudo touch /mnt/a.c $ ls a.c
Operations on PC
Now, you can see the new partition /dev/sdx is mounted.
$ lsblk ...... sdd 8:48 1 512M 0 disk /mnt $ ls /mnt a.c
Attention
When add files to this shared space, the other side needs to be unmounted and remounted the shared space.For example:
On Rock Pi E: Create a new file to it.
$ sudo touch /mnt/b.c $ ls a.c b.c
On PC:
$ ls /mnt a.c
It just have one file a.c, new you should remount to update it.
$ sudo umount /mnt $ sudo mount /dev/sdd /mnt $ ls /mnt a.c b.c