USB 3.0 power for external storage

I would like to attach an external SSD/NVMe drive to a ROC-RK3328-CC USB 3.0 connector to take advantage of for better storage speeds than uSD and the limited write cycles of most uSD cards. My Renegades are DIN-rail mounted and I attached one of the popular Orico M2PV-C3 (Realtek RTL9210 - see tools) enclosures to the mounting board and connected it to the USB3.0 port. The Renegade saw the enclosure and drive (shows up properly in lsusb -tv and lsblk showed the partitions), but there were numerous IO errors and the drive could not be mounted or partitioned.

However, when I attach the same drive enclosure to a powered USB 2.0 hub connected to the Renegade, all is well; the drive is recognized and I can partition and format it. This suggests that either the USB 3.0 port on the Renegade can’t provide sufficient power for the drive or there’s a problem with the USB3.0 comms (I suspect it’s a power limitation and will try to find a USB 3.0 hub to confirm). So two questions:

  1. Is there a specification for how much current the Renegade can source over the USB 3.0 port?
  2. Is there a better way to supply power to the board than via the micro-USB connector? (soldering is fine).

Thanks!

MicroUSB is designed to power the board and minor peripherals. Spinning hard drives and SSDs are major peripherals that consume more than 5W (5V 1A) and are not supported without external power or a powered USB hub. USB 3.0 on Renegade is limited to 1A (USB 3.0 Type A spec is 0.9A without additional signaling). You can try to limit the SSD to PS1 (4W) or PS2 (3W) but PS0 (8W) is much too high for MicroUSB to power both the board and the device. Spinning hard drives can use even more on startup.

Thank you @librecomputer the power specs for the ports were exactly what I was looking for. For anyone else looking, 900mA is indeed the 3.0 power specification, so this is not a limitation of the Renegade, it is simply performing to the USB spec. I asked only because some 3.0 ports are designed to meet the battery charging spec and can source more current, but that is not a required element of 3.0.

I’ve already ordered powered USB 3.0 hubs that can source more current and will also try a Y-cable to allow the drive to draw additional power from one of the USB 2.0 ports to see which solves my NVME drive power problems; I’ll report results back here.

The other question was about alternate ways to deliver power to the Renegade. Although admittedly the micro-USB port has been doing fine, when I use RPis in DIN-rail applications, I solder heavier gauge wire to the power entry points (ground and the PTC) and use pluggable screw terminals for compatibility with the 5V power distribution rail. From the Renegade schematic (sheet 16), it looks like testpoint (VBUS50) is perfect; hopefully it’s labeled on the silkscreen and I assume there is a good ground testpoint somewhere too. As a suggestion, for industrial applications, 1x2 0.100 spaced pads for adding a (polarized, latching) power connection header would be a great addition to a future layout if you have space for it.

Thanks again for a great product!

1 Like

We do not recommend this. SSDs can use 8W (1.65A) while the best MicroUSB can push through the 5V pin is around 2.0-2.5A without a huge voltage drop.

Per the schematics, VCC_SYS is exposed as on the 40-pin J1 header on pin 2 and 4. You can directly power the board there with a sufficient gauge wire.

Thanks again; my intent is to power the board directly from a quiet, low-impedance supply using appropriate gauge wire and avoid the microUSB connector. I was hoping to supply power via the USB1 side of F1 to preserve the over-current and ESD protection, but if I can’t find a good point to tap in, I will feed VCC_SYS via J1 (pins 2,4 and 8,9) and fuse it externally as you suggest.

Being able to use an NVMe drive with the ROC-RK3328-CC would add a lot of utility (and speed and reliability); doing it without a separate external hub would be much simpler and more compact. I’ll look for low-power NVMe modules and will measure peak current to see if using the power from both the 3.0 and a 2.0 USB port will be sufficient (I have a Joulescope which is handier than an o’scope for monitoring and logging peak and average current over a wide dynamic range as well as monitoring the voltage drop at peak current).

Thanks again for the responses and the great products!

NVMe is designed with different power modes (PS0 to PS3) although maybe needs to be set at initialization in software. The bridge control must support the commands.

In case anyone is following this, it looks like the dual-cable approach (1xUSB3.0 port + 1x USB2.0 port) is working. FYI, I’m using this cable: Amazon.com and an Orico M2PV drive enclosure (Amazon.com). Power to the Renegade is a 5V/3A supply and a short USB-C cable with heavier-than-normal gauge wires.

I’ll do more testing including checking how low the voltage drops on the 5V rail and follow up on this. HOWEVER, I also did not see the performance gains I expected with an NVMe drive:

dalbert@renegade:~ $ sudo hdparm -Tt /dev/mmcblk1p2

/dev/mmcblk1p2:
 Timing cached reads:   1900 MB in  2.00 seconds = 950.25 MB/sec
 Timing buffered disk reads: 194 MB in  3.03 seconds =  63.96 MB/sec
dalbert@renegade:~ $ sudo hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   1836 MB in  2.00 seconds = 917.99 MB/sec
 Timing buffered disk reads: 102 MB in  3.00 seconds =  33.98 MB/sec

So this may not be a useful exercise (although the NVMe drive may still be a better storage medium for things that do a lot of disk writes (e.g. databases, logs).

As @librecomputer had noted, the NVMe drive supports several power modes and I’m going to look into how to disable mode 0:

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        5       5
 1 +     4.60W       -        -    1  1  1  1       30      30
 2 +     3.80W       -        -    2  2  2  2       30      30
 3 -   0.0700W       -        -    3  3  3  3    10000     300
 4 -   0.0050W       -        -    4  4  4  4     2000   10000

That looks like you are only using USB 2.0 speeds. USB 3.0 should yield a few hundred MB/s.

librecomputer

That looks like you are only using USB 2.0 speeds. USB 3.0 should yield a few hundred MB/s.

It’s definitely using USB 2.0 (see output of lsusb below). I haven’t had time to look into why. The data connector of the cable is plugged into the USB 3.0 port. Most likely is what you suggested: insufficient power (see the following thread). I’ll try it with a powered USB 3.0 hub tomorrow.

Realtek RTL9210 chipset (NVMe to USB) initialized but seems doesn’t work correctly on PRI 4 · Issue #4130 · raspberrypi/linux · GitHub

dalbert@pitest:~ $ lsusb -v -d 0bda:9210

Bus 002 Device 002: ID 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x9210 RTL9210 M.2 NVME Adapter
  bcdDevice           20.01
  iManufacturer           1 Realtek
  iProduct                2 RTL9210
  iSerial                 3 012345678904
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0

The SSD’s 9W power consumption is twice that of our board. The enclosure should have a method or a cable that lets you use an external power supply to feed power to the SSD and avoid having the board power it.

I added a powered USB 3.0 hub (Coolgear USBG-4U3MLR2) and the Renegade recognizes it as a 3.0 hub.

Bus 003 Device 002: ID 05e3:0612 Genesys Logic, Inc. Hub
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0
  bDeviceProtocol         3
  bMaxPacketSize0         9
  idVendor           0x05e3 Genesys Logic, Inc.
  idProduct          0x0612 Hub
  bcdDevice           92.07
  iManufacturer           1 GenesysLogic
  iProduct                2 USB3.0 Hub

The hub can deliver 900mA to each port so 1.8A * 5V = 9W. I connected the NVMe drive enclosure to it using a two-headed USB cable (one for signal, one for power). Unfortunately, the drive still enumerates as a USB 2.0 device.

Bus 002 Device 003: ID 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x9210 RTL9210 M.2 NVME Adapter
  bcdDevice           20.01

So I no longer think the problem is power…

Does the hub enumerate as an USB 3.0 device? sudo lsusb -t

Yes, it is Bus 3 device 2. My prior output was using lsusb -v -d vid:pid to show more device detail.

The output from lsusb -t is shown below:

$ sudo lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
        |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
        |__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M

Renegade after boot without the USB 3.0 hub connected:

$ lsusb -tv
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
    ID 1d6b:0001 Linux Foundation 1.1 root hub
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 480M
        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
            ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub

After connecting the 3.0 Hub but not the NVMe drive (hub shows up as USB 3.0: Bus 03:Dev2 and also as USB 2.0: Bus 2:Dev2):

$ lsusb -tv
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
    ID 1d6b:0001 Linux Foundation 1.1 root hub
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 480M
        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
            ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 05e3:0612 Genesys Logic, Inc. Hub
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 05e3:0610 Genesys Logic, Inc. Hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg output:

[   77.456481] usb 2-1: new high-speed USB device number 2 using xhci-hcd
[   77.619033] usb 2-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice=92.07
[   77.619077] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   77.619100] usb 2-1: Product: USB2.0 Hub
[   77.619117] usb 2-1: Manufacturer: GenesysLogic
[   77.655408] hub 2-1:1.0: USB hub found
[   77.656788] hub 2-1:1.0: 4 ports detected
[   77.741027] usb 3-1: new SuperSpeed USB device number 2 using xhci-hcd
[   77.766037] usb 3-1: New USB device found, idVendor=05e3, idProduct=0612, bcdDevice=92.07
[   77.766074] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   77.766090] usb 3-1: Product: USB3.0 Hub
[   77.766102] usb 3-1: Manufacturer: GenesysLogic
[   77.798889] hub 3-1:1.0: USB hub found
[   77.799361] hub 3-1:1.0: 4 ports detected

Plug NVMe drive into USB 3.0 hub:

$ lsusb -tv
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
    ID 1d6b:0001 Linux Foundation 1.1 root hub
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 480M
        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
            ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 05e3:0612 Genesys Logic, Inc. Hub
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 05e3:0610 Genesys Logic, Inc. Hub
        |__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
            ID 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg:

[  348.100194] usb 2-1.3: new high-speed USB device number 3 using xhci-hcd
[  348.207025] usb 2-1.3: New USB device found, idVendor=0bda, idProduct=9210, bcdDevice=20.01
[  348.207071] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  348.207093] usb 2-1.3: Product: RTL9210
[  348.207111] usb 2-1.3: Manufacturer: Realtek
[  348.207130] usb 2-1.3: SerialNumber: 012345678904
[  348.218226] usb-storage 2-1.3:1.0: USB Mass Storage device detected
[  348.219326] usb-storage 2-1.3:1.0: Quirks match for vid 0bda pid 9210: 800000
[  348.219610] scsi host0: usb-storage 2-1.3:1.0
[  348.296238] usbcore: registered new interface driver uas
[  349.226894] scsi 0:0:0:0: Direct-Access     Realtek  RTL9210 NVME     1.00 PQ: 0 ANSI: 6
[  349.235994] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
[  349.237437] sd 0:0:0:0: [sda] Write Protect is off
[  349.237464] sd 0:0:0:0: [sda] Mode Sense: 37 00 00 08
[  349.238433] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  349.281653]  sda: sda1 sda2 sda3
[  349.282703] sd 0:0:0:0: [sda] Attached SCSI disk

So the hub is recognized as USB 3.0, but the attached NVMe drive is connecting as USB 2.0. I don’t think it’s a power issue; I suspect I either need a different hub or, more likely, a different USB-NVMe drive adapter. Do you know of a USB-NVMe drive adapter that is known to work with the Renegade running Debian Bullseye (11)?

Thanks again for all the help and time!

If the hub enumerated as 5Gb and the device does not, it is either the cable or the device.

You’re right, it was the cable! I went back to using the short USB A-C cable that came with the drive and it now enumerates as a USB 3 device.

So the formula for anyone else looking to add an NVMe drive to their Renegade is:

  • USB 3.x powered hub. I used a Coolgear USBG-4U3MLR2 because my systems are DIN-rail mounted
  • Orico M2PV-C3 drive enclosure ($15 on amazon)
  • An NVMe drive (of course)
  • Use the short USB A-C cable that comes the drive enclosure to connect the Orico drive to the hub.
  • Connect the hub to the Renegade USB 3.0 port using a USB 3.0 type A cable like this one for the above hub:

image

The results are shown below: the drive enclosure enumerates as supporting USB 3.20 and the drive is about 4x faster than the uSD card.

$ sudo hdparm -t /dev/mmcblk1
/dev/mmcblk1:
 Timing buffered disk reads: 200 MB in  3.02 seconds =  66.28 MB/sec
$ sudo hdparm -t /dev/sda
/dev/sda:
 Timing buffered disk reads: 800 MB in  3.00 seconds = 266.52 MB/sec

Note: the drive and enclosure are capable of considerably faster transfer rates, but this is still a huge improvement, and I’m much more comfortable having a database (and anything else that writes to disk frequently) on an external NVMe drive than on uSD storage.

4 Likes

Thanks for this post. I’m also planning to make a NAS but will use HDD instead. Maybe with powered USB hub I can go for External HDD; use one USB port for HDD, and another port to power the Le Potato.

This is the recommended setup. Some hubs have power only ports so that one USB channel on the hub is not wasted.

Interesting. This thread helped me to debug an oddity on my Windows Dev Kit 2023 USB-C ports. The SSD enclosure only showed up as USB2.0, same box running with Windows shows up as USB3.2. It appears to be the power limit on the USB-C (500mA). On an USB-A connector it shows 896mA and registers as USB3.2 with 10000M bandwidth. Need to investigate how to set the power right.

USB 2.0 spec sets 500mA (0.5A) as the max without BC spec. USB 3.0 spec sets 900mA (0.9A) as the max without BC/PD specs. If you plug in a USB 2.0 device without BC/PD on a 3.0 port, it will show 500mA as the power limit instead of 900mA.