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

Difference between revisions of "RockpiE/dev/usb-mass-storage"

< RockpiE‎ | dev
(Attention)
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
=== Description ===
 
=== Description ===
 
+
This guide describes how to setup USB Mass Storage OTG on ROCK Pi E.
This guide describe how to setup USB Mass Storage OTG on ROCK Pi E.
+
  
 
=== Requirement ===
 
=== Requirement ===
Line 45: Line 44:
 
   $ sudo apt-get install -y linux-4.4-rock-pi-e-latest
 
   $ sudo apt-get install -y linux-4.4-rock-pi-e-latest
  
Step 3: Add the following to '''/etc/modules'''
+
Step 3: Reboot the device.
  $ 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
 
   $ sudo reboot
  
Step 5: Create a file to be a shared space and make it FAT32 type.
+
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 dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress
 
   $ sudo apt-get install dosfstools
 
   $ sudo apt-get install dosfstools
   $ sudo mkfs.fat /piusb.bin -F 32 -I
+
   $ sudo mkfs.fat /home/rock/share -F 32 -I
  
Step 6: Enable usb mass storage with the file
+
Step 5: Enable usb mass storage with the file
 
   $ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1
 
   $ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1
 
   $ sudo mount /home/rock/share /mnt/
 
   $ sudo mount /home/rock/share /mnt/
 
   $ sudo touch /mnt/a.c
 
   $ sudo touch /mnt/a.c
   $ ls  
+
   $ ls /mnt
 
   a.c
 
   a.c
  
Line 80: Line 71:
  
 
On Rock Pi E:
 
On Rock Pi E:
 +
 
Create a new file to it.
 
Create a new file to it.
 
   $ sudo touch /mnt/b.c
 
   $ sudo touch /mnt/b.c
   $ ls  
+
   $ ls /mnt
 
   a.c b.c
 
   a.c b.c
  
Line 88: Line 80:
 
   $ ls /mnt
 
   $ ls /mnt
 
   a.c
 
   a.c
It just have one file a.c, new you should remount to update it.
+
It just have one file a.c, now you should remount to update it.
 
   $ sudo umount /mnt
 
   $ sudo umount /mnt
 
   $ sudo mount /dev/sdd /mnt
 
   $ sudo mount /dev/sdd /mnt
Line 96: Line 88:
 
=== Troubleshooting ===
 
=== Troubleshooting ===
  
* If you have issue with USB Mass Storage OTG, start a new post on the forum. https://forum.radxa.com/c/dev
+
* If you have issue with USB Mass Storage OTG, start a new post on the forum. https://forum.radxa.com/c/rockpie

Latest revision as of 06:15, 24 September 2021

    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 /mnt
  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 /mnt
  a.c b.c

On PC:

 $ ls /mnt
  a.c

It just have one file a.c, now you should remount to update it.

 $ sudo umount /mnt
 $ sudo mount /dev/sdd /mnt
 $ ls /mnt
  a.c b.c

Troubleshooting