USB-C DAS (Is it or is it NOT supported?)


slymanjojo
 Share

2 2

Recommended Posts

Has anybody got DAS mode working using USB-C ? 

 

Using: Armbian 20.08.21 Buster with Linux 5.8.17-rockchip64

 

I was not certain, I thought I read it was supported.     I was hoping to use Windows 10 via USB 3.1  -->  Helios64 USB-C  to copy large video library.

 

Note; using UART via COM3 is working as expected.

Note; in windows I do remember seeing some USB error loading some USB driver; would it be related to some missing driver?int

 

Any successful implementation of USB DAS interface; I would be happy to hear from you.

 

 

 

 

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

On 11/15/2020 at 11:49 PM, gprovost said:

In the upcoming Armbian 20.11 (Linux Kernel 5.9) USB-C DAS mode will be supported.

 

For now only Linux Kernel 4.4 supports it, you can see how to set it up on our wiki : https://wiki.kobol.io/helios64/usb/#usb-under-linux

 

I think this section of our wiki is not easy to find, we will have to move it a more obvious place :P

Thanks I've downgraded to Linux Kernel 4.4 to test it out; will use referenced URL thank you.

Is there an ETA for 5.9?

 

Again thanks for your support.

Link to post
Share on other sites

 

@slymanjojo to use DAS on LK 5.9, you would need to configure the USB-C as device mode.

 

In your helios64, create a file dwc3-0-device.dts contains following code

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";

	fragment@0 {
		target = <&usbdrd_dwc3_0>;
		__overlay__ {
			dr_mode = "peripheral";
		};
	};
};

add and enable to user overlay

sudo armbian-add-overlay dwc3-0-device.dts

and reboot

 

Now, you can follow instruction on our wiki to enable DAS. If you are using Windows, you might need to unplug and replug the usb cable after enabling the DAS mode. 

---

If you want to use USB-C in Host mode, you need to remove folloing line from /boot/armbianEnv.txt

user_overlays=dwc3-0-device

and enable host mode overlay on armbian-config > System > Hardware and tick dwc3-0-host

Link to post
Share on other sites

Thanks for the quick response, @aprayoga!

 

I gave it a shot and unfortunately it doesn't seem to work for me.

 

I've upgraded to Armbian 20.11, which includes LK 5.9:

 

XXXXX@helios64:~ $ uname -r
5.9.10-rockchip64
XXXXX@helios64:~ $ cat /etc/os-release
PRETTY_NAME="Armbian 20.11 Buster"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

 

I've created that file and applied the user overlay as suggested:

 

XXXXX@helios64:/etc $ cat dwc3-0-device.dts
/dts-v1/;
/plugin/;

/ {
        compatible = "rockchip,rk3399";

        fragment@0 {
                target = <&usbdrd_dwc3_0>;
                __overlay__ {
                        dr_mode = "peripheral";
                };
        };
};

 

XXXXX@helios64:/etc $ sudo armbian-add-overlay dwc3-0-device.dts
Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Overlay dwc3-0-device was already added to /boot/armbianEnv.txt, skipping
Reboot is required to apply the changes
XXXXX@helios64:/etc $ sudo reboot

 

And then after the reboot:

 

XXXXX@helios64:~ $  sudo modprobe g_mass_storage file=/dev/sda,/dev/sdb,/dev/sdd iSerialNumber=1234567890 iManufacturer="Kobol Innovations" iProduct=Helios64

 

I see the following in /var/log/syslog:

 

Nov 27 15:26:36 localhost kernel: [ 3714.194647] Mass Storage Function, version: 2009/09/11
Nov 27 15:26:36 localhost kernel: [ 3714.194664] LUN: removable file: (no medium)
Nov 27 15:26:36 localhost kernel: [ 3714.194866] LUN: file: /dev/sda
Nov 27 15:26:36 localhost kernel: [ 3714.194973] LUN: file: /dev/sdb
Nov 27 15:26:36 localhost kernel: [ 3714.195075] LUN: file: /dev/sdd
Nov 27 15:26:36 localhost kernel: [ 3714.195083] Number of LUNs=3
Nov 27 15:26:36 localhost kernel: [ 3714.195344] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
Nov 27 15:26:36 localhost kernel: [ 3714.195354] g_mass_storage gadget: g_mass_storage ready

 

I've tried with both a Windows PC and a Linux (Debian) PC, with no luck.

 

I can try and provide anything else needed to troubleshoot, though it may take some time as I'm limited to just one post per day.

 

Thanks!

Link to post
Share on other sites

Thanks @Zageron, my account's been "activated"!

 

Kobol folks, if it helps, I see the following when plugging/unplugging the USB cable onto a Debian PC:

 

XXXXX@deadshot:~ $ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 5: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
XXXXX@deadshot:~ $ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 5: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    |__ Port 2: Dev 26, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

 

Seems that Helios64 gets picked up as this:
 

Port 2: Dev 26, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M


with the following line via lsusb (without the -t flag):

 

Bus 002 Device 025: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)

 

Link to post
Share on other sites

Thanks, @gprovost, that does appear to be the case.

 

I'm not sure why that is, though.  I'm fairly certain I'm using a USB 3.0 port on my Debian PC.  I plugged an external HDD into the same port and I think it gets recognized as a USB 3.0 port (I'm guessing because of the 5000M:

 

XXXXX@deadshot:~ $ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 6: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

 

When I plug my Helio64 into the same port on my Debian PC, using the included USB Type-C to USB-A cable, it doesn't show as a Mass Storage device:

 

XXXXX@deadshot:~ $ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    |__ Port 10: Dev 7, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

 

EDIT: Not sure what I did, but it suddenly started working:

 

XXXXX@deadshot:~ $ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 3: Dev 7, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 5: Dev 6, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    |__ Port 3: Dev 10, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

 

I see both the FTDI and the Mass Storage device (the other is another external drive I have).  I guess I won't look a gift horse in the mouth and be glad that it's working!

Link to post
Share on other sites

On 11/25/2020 at 10:44 PM, aprayoga said:

 

@slymanjojo to use DAS on LK 5.9, you would need to configure the USB-C as device mode.

 

In your helios64, create a file dwc3-0-device.dts contains following code


/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";

	fragment@0 {
		target = <&usbdrd_dwc3_0>;
		__overlay__ {
			dr_mode = "peripheral";
		};
	};
};

add and enable to user overlay


sudo armbian-add-overlay dwc3-0-device.dts

and reboot

 

Now, you can follow instruction on our wiki to enable DAS. If you are using Windows, you might need to unplug and replug the usb cable after enabling the DAS mode. 

---

If you want to use USB-C in Host mode, you need to remove folloing line from /boot/armbianEnv.txt


user_overlays=dwc3-0-device

and enable host mode overlay on armbian-config > System > Hardware and tick dwc3-0-host

I' upgraded to

 

On 11/25/2020 at 10:44 PM, aprayoga said:

 

@slymanjojo to use DAS on LK 5.9, you would need to configure the USB-C as device mode.

 

In your helios64, create a file dwc3-0-device.dts contains following code


/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";

	fragment@0 {
		target = <&usbdrd_dwc3_0>;
		__overlay__ {
			dr_mode = "peripheral";
		};
	};
};

add and enable to user overlay


sudo armbian-add-overlay dwc3-0-device.dts

and reboot

 

Now, you can follow instruction on our wiki to enable DAS. If you are using Windows, you might need to unplug and replug the usb cable after enabling the DAS mode. 

---

If you want to use USB-C in Host mode, you need to remove folloing line from /boot/armbianEnv.txt


user_overlays=dwc3-0-device

and enable host mode overlay on armbian-config > System > Hardware and tick dwc3-0-host

OK.....I upgraded to "Armbian 20.11 Buster with Linux 5.9.10-rockchip64" and I want to add the USB-C DAS. One noob question.....do I create/add the dwc3-0-device.dts file to the folder: /boot/dtb/rockchip/ ?

Thanks....

Link to post
Share on other sites

I've been trying to set this up, but can't get my Mac to recognize the g_mass_storage device.  Any troubleshooting tips?

 

I don't see anything in the System Information panel; I was able to communicate via USB to the helios64 when in recovery mode (e.g. flashing the Armbian ROM), so I assume my connection is OK.

 

I have the following in the syslog:

Feb  2 12:26:13 helios64 kernel: [   49.903323] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

Feb  2 12:26:13 helios64 kernel: [   49.903337] g_mass_storage gadget: g_mass_storage ready

 

My goal is to setup the helios64 in DAS mode so I can format the RAID group to exFat and use it for photo processing.  But I can't seem to get the device to even be recognized on the Mac (unlike when in recovery mode, it shows up as an uninitilized disk)

 

 

Link to post
Share on other sites

Quick follow up with another curiosity.

 

I decide to try to flash the legacy 4.4 image, and the gadget DOES show up in MacOS.

 

Here's the relevant syslog

Feb  2 18:21:56 helios64 kernel: [  754.704394] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

Feb  2 18:21:56 helios64 kernel: [  754.704408] g_mass_storage gadget: g_mass_storage ready

Feb  2 18:21:56 helios64 kernel: [  755.092846] g_mass_storage gadget: super-speed config #1: Linux File-Backed Storage

 

However, instead of presenting the full 18TB that it should be, the size is only 210GB.  Anyone seen this before?

Edited by lalaw
Link to post
Share on other sites

@lalaw recovery mode use usb 2.0 signals while g_mass_storage use the USB 3.0 signals. Since you were able to test it under 4.4 and works at super-speed, your connection seems ok.

how did you load the g_mass_storage kernel module? have you tried to unplug and re-plug the usb cable after loading the g_mass_storage module?

Link to post
Share on other sites

4 minutes ago, aprayoga said:

@lalaw recovery mode use usb 2.0 signals while g_mass_storage use the USB 3.0 signals. Since you were able to test it under 4.4 and works at super-speed, your connection seems ok.

how did you load the g_mass_storage kernel module? have you tried to unplug and re-plug the usb cable after loading the g_mass_storage module?

 

Hi!

 

I followed your overlay instructions at the top of this thread.  

 

Here's the exact command (after setting up the overlay/rebooting):

sudo modprobe g_mass_storage file=/dev/md0 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890" removable=1

 

(Note: I tried both with/without the 'removable' option specified) 

 

I tried plugging/unplugging.  Rebooting.  Different ports, etc.

 

I'll try to flash back to 5.9 one more time to see if I did something differently.  Do you have any idea why the gadget would present as such a small capacity?

Edited by lalaw
Link to post
Share on other sites

Documenting my full process:

 

1. Put helios64 into recovery mode.

2. Use BalenaEtcher to write Armbian_20.11.10_Helios64_buster_current_5.9.14.img.xz to eMMC.  Reboot

3. Go through 1st login on helios64, setup userrname/password.  Reboot

4. Go through armbian-config to install OMV.  Reboot

5. Per 25-NOV post, created dwc3-0-device.dts and added as an overlay.  Reboot

 

Quote

Compiling the overlay

Copying the compiled overlay file to /boot/overlay-user/

Reboot is required to apply the change

 

6. Login to OMV. Setup RAID 10 array.  

 

... To be updated after array is synced.

 

Side note, I remembered that I have a 5th drive that is not part of the array that I could try to mount:

Quote

 

sudo modprobe g_mass_storage file=/dev/sdf1 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890"

sudo cat /var/log/syslog

 

Feb  2 19:32:34 helios64 kernel: [  553.366779] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

Feb  2 19:32:34 helios64 kernel: [  553.366792] g_mass_storage gadget: g_mass_storage ready

 

Unfortunately, no device detected on the Mac.

 

Link to post
Share on other sites

1 hour ago, lalaw said:

Do you have any idea why the gadget would present as such a small capacity?

i have no idea why. Initially i thought you were exporting just the partition but your next reply show you exported the whole array.

Any error or warning on Mac side?

 

20 minutes ago, lalaw said:

sudo modprobe g_mass_storage file=/dev/sdf1 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890"

don't export just the partition (sdf1) but the whole disk (sdf). It does not have partition table.

Link to post
Share on other sites

13 minutes ago, aprayoga said:

i have no idea why. Initially i thought you were exporting just the partition but your next reply show you exported the whole array.

Any error or warning on Mac side?

 

 

No warnings.  I wonder if it had to do with trying to export it before it was fully sync'ed. 

 

 

Quote

don't export just the partition (sdf1) but the whole disk (sdf). It does not have partition table.

Just tried removing (sudo modprobe -r g_mass_storage) and recreating using just sdf, but nothing showing still on the Mac.

Link to post
Share on other sites

Continuing from above.

 

Documenting my full process:

 

1. Put helios64 into recovery mode.

2. Use BalenaEtcher to write Armbian_20.11.10_Helios64_buster_current_5.9.14.img.xz to eMMC.  Reboot

3. Go through 1st login on helios64, setup userrname/password.  Reboot

4. Go through armbian-config to install OMV.  Reboot

5. Per 25-NOV post, created dwc3-0-device.dts and added as an overlay.  Reboot

 

Quote

 

Compiling the overlay

Copying the compiled overlay file to /boot/overlay-user/

Reboot is required to apply the change

 

 

6. Login to OMV. Setup RAID 10 array.  

 

 

7. RAID array in sync.  Added device (sudo modprobe g_mass_storage file=/dev/md0 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890") No device on Mac.

8. Tried unplugging, replugging USB cable.  No device on Mac

9. Tried different USB ports.  No device.

10. Tried removing and re-adding (modprobe -r, modprobe).  No device.

11. Tried removing and re-adding overlay (from /boot/armbianEnv.txt).  N device.

11. Tried rebooting Helios64 and repeating 8-11.  No device.

 

 

I'm going to flash 4.4 back again and see what I get.  Will report back

Link to post
Share on other sites

Update.

 

Good news: shift to 4.4 makes the array show up via DAS mode.

Bad news: I'm pulling my hair out because of some weird issues:

 

1. Had what seemed like random partitions pop up and that required me to do a bunch of hackery with fdisk/parted

2. Finally got to setting up the array as a 18.2 TB partition.  Plugging into the Mac, I always get an uninitialiized (or unrepairable) error.

 

The weird part is that if I try to format or repair the disk, I always get something like 210 GB of capacity.  This is using ExFat, HFS+, etc.

Occasionally, I can get the Mac to recognize it as an 18TB, unformatted device.  But after formatting, it always goes back to 210GB.

 

Anyone with a bit more insight that can help me troubleshoot whats going on?

Link to post
Share on other sites

One minor update.  

 

I managed to create and mount an exFat drive in OMV by installing the fuse extensions.

I managed further to mount the drive in DAS mode on my Mac.

It is recognized as the full 20TB capacity, BUT I get an error

 

'"macOS can't repair the disk "helios64"  You can still open or copy files on the disk, but you can't save changes to the files on the disk.  Back up the disk and reformat it as soon as you can."

 

 

Here's my command: sudo modprobe g_mass_storage file=/dev/md0p1 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890" ro=0 removable=1 stall=0

 

I am able to read the small test files I put in the partition, but the disk is not writable.

 

When I try to format the disk from the Mac, it drops back down the the 210GB capacity.

Link to post
Share on other sites

 Share

2 2