Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

RockpiE/dev/usb-mass-storage

< RockpiE‎ | dev
Revision as of 04:08, 24 September 2021 by Stephen (Talk | contribs)

    ROCK Pi E >  Development >  USB Mass Storage

Description

This guide describes 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: Reboot the device.

 $ sudo reboot

Step 4: 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 /home/rock/share -F 32 -I

Step 5: 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

Troubleshooting