Adding a USB Port to PocketBeagle

I have added a USB Type A connector to my Pocket Beagle. When I plug a Kingston 8GB Flash Key into the port and boot the PocketBeagle, I can see that the device is sort of detected, but I never get access to the Flash.

In /var/log/messages I see the following block:

Sep 28 12:08:19 beaglebone kernel: [ 2.177870] usbcore: registered new interface driver usb-storage
Sep 28 12:08:19 beaglebone kernel: [ 2.180479] 47401300.usb-phy supply vcc not found, using dummy regulator
Sep 28 12:08:19 beaglebone kernel: [ 2.183416] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.183453] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
Sep 28 12:08:19 beaglebone kernel: [ 2.183781] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
Sep 28 12:08:19 beaglebone kernel: [ 2.183795] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Sep 28 12:08:19 beaglebone kernel: [ 2.183805] usb usb1: Product: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.183814] usb usb1: Manufacturer: Linux 4.4.88-ti-r125 musb-hcd
Sep 28 12:08:19 beaglebone kernel: [ 2.183824] usb usb1: SerialNumber: musb-hdrc.0.auto
Sep 28 12:08:19 beaglebone kernel: [ 2.184765] hub 1-0:1.0: USB hub found
Sep 28 12:08:19 beaglebone kernel: [ 2.184832] hub 1-0:1.0: 1 port detected
Sep 28 12:08:19 beaglebone kernel: [ 2.187254] 47401b00.usb-phy supply vcc not found, using dummy regulator
Sep 28 12:08:19 beaglebone kernel: [ 2.189903] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.189941] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
Sep 28 12:08:19 beaglebone kernel: [ 2.190429] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
Sep 28 12:08:19 beaglebone kernel: [ 2.190444] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Sep 28 12:08:19 beaglebone kernel: [ 2.190454] usb usb2: Product: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.190463] usb usb2: Manufacturer: Linux 4.4.88-ti-r125 musb-hcd
Sep 28 12:08:19 beaglebone kernel: [ 2.190473] usb usb2: SerialNumber: musb-hdrc.1.auto
Sep 28 12:08:19 beaglebone kernel: [ 2.191478] hub 2-0:1.0: USB hub found
Sep 28 12:08:19 beaglebone kernel: [ 2.191554] hub 2-0:1.0: 1 port detected

Notice that the network blocks are usb1 and usb2. Without the Flash key inserted, those lines would be usb0 and usb1.

lsmod shows:

usb_f_mass_storage 51139 2

So shouldn’t I have a /dev/sdX device then?

I have added a USB Type A connector to my Pocket Beagle. When I plug a Kingston 8GB Flash Key into the port and boot the PocketBeagle, I can see that the device is sort of detected, but I never get access to the Flash.

How did you wire it? Here’s how I’ve connected a microUSB:

PocketBeagle_microUSB_bb.png

I’m looking for a good Fritzing element for the USB type-A, but it is largely the same except that ID and GND are tied together (connector is only 4-pin).

In /var/log/messages I see the following block:

Sep 28 12:08:19 beaglebone kernel: [ 2.177870] usbcore: registered new interface driver usb-storage
Sep 28 12:08:19 beaglebone kernel: [ 2.180479] 47401300.usb-phy supply vcc not found, using dummy regulator
Sep 28 12:08:19 beaglebone kernel: [ 2.183416] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.183453] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
Sep 28 12:08:19 beaglebone kernel: [ 2.183781] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
Sep 28 12:08:19 beaglebone kernel: [ 2.183795] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Sep 28 12:08:19 beaglebone kernel: [ 2.183805] usb usb1: Product: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.183814] usb usb1: Manufacturer: Linux 4.4.88-ti-r125 musb-hcd
Sep 28 12:08:19 beaglebone kernel: [ 2.183824] usb usb1: SerialNumber: musb-hdrc.0.auto
Sep 28 12:08:19 beaglebone kernel: [ 2.184765] hub 1-0:1.0: USB hub found
Sep 28 12:08:19 beaglebone kernel: [ 2.184832] hub 1-0:1.0: 1 port detected
Sep 28 12:08:19 beaglebone kernel: [ 2.187254] 47401b00.usb-phy supply vcc not found, using dummy regulator
Sep 28 12:08:19 beaglebone kernel: [ 2.189903] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.189941] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
Sep 28 12:08:19 beaglebone kernel: [ 2.190429] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
Sep 28 12:08:19 beaglebone kernel: [ 2.190444] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Sep 28 12:08:19 beaglebone kernel: [ 2.190454] usb usb2: Product: MUSB HDRC host driver
Sep 28 12:08:19 beaglebone kernel: [ 2.190463] usb usb2: Manufacturer: Linux 4.4.88-ti-r125 musb-hcd
Sep 28 12:08:19 beaglebone kernel: [ 2.190473] usb usb2: SerialNumber: musb-hdrc.1.auto
Sep 28 12:08:19 beaglebone kernel: [ 2.191478] hub 2-0:1.0: USB hub found
Sep 28 12:08:19 beaglebone kernel: [ 2.191554] hub 2-0:1.0: 1 port detected

Notice that the network blocks are usb1 and usb2. Without the Flash key inserted, those lines would be usb0 and usb1.

The index delta is interesting. Did you change the device tree at all? I attempted to make the default device tree enable host mode on the USB1 (hardware) port.

Even though the controller shows up, you don’t seem to have the flash drive showing up. Are VBUS and ID connected properly?

lsmod shows:

usb_f_mass_storage 51139 2

I believe that is just the “function” mass storage class driver, ie. slave, not master.

Issue was solved via help from the IRC channel. Issue was the Extra pins needing to be shorted to GND and 5V.

I have now created a Expansion board that adds a Host port with proper switching of power, and ESD protection. Details are at:
https://oshpark.com/shared_projects/IrizTrr1

Which pins are to +5 and gnd?

Thanks!
Andy

On the expansion connectors, the +5V from the built-in USB port is connected to the pins labeled VOUT on the back. GND labels ground pins.

On the pinouts 5,7,9,11,13 and 15 are shown as USB1. So:

tie ID to Gnd (15,13) and 15 to gnd on the connector
There is a Vin(7) and Vbus(5). One of those are not used for the +5 connection? So +5 goes to pin Vout(13)

Is Vin used when the power is flowing into the PB from the USB?

Thanks
Andy

If you are just trying to hook up a quick and dirty connection, then tie 15 and 13 together for grounding the ID pin. Then you will tie 5 and 7 together so the CPU understands there is a USB port in use and it is powered. Your USB connector connects then to pins 7, 9, 11, and 15. Pin 15 is already connected to system ground.

In my circuit I am using the Power section from the BBB to do this a bit cleaner.

Sounds good to me.

Thanks for the great input.

Andy

Dan:

What is the part number for your U4 ?

You are going to have to add some I2C pull-up resistors somewhere.

Thanks,
— Graham

U4 is a USBLC6-2.

As for the I2C pullups, I forgot to add to this board as I have them on another. I’ll add here too…

The on-chip pull-ups work for most cases.

I hacked a “quick and dirty” second USB port as described.
Then connected a LAN7500 USB-2 to Gb-Ethernet board.
Came right up, drivers are already in the kernel, no device tree changes.
Connected to the network at 1 Gb.

speedtest-cli results (on a 1 Gb up/down network)
Download 27 Mbps, Upload 41 Mbps.

And it has a legitimate MAC address. :slight_smile:

(for comparison, BBB Rev.C is download 60 Mbps, upload 70 Mbps, which
is about all I would expect out of a 100 Mbps connection.)

— Graham

once.

I've real world tested ethernet on several A5A's, several C's, and a
boatload of green's. Down speeds 11.6MB/s( that's megabyte ), up speed
11.4-11.5MB/s.

Real world test was a NFS share, reading / writing 1GB of data, or more.

Additionally, I've benchmarked USB networking, Down speeds 105 Mbit/s, and
uploads were a bit shy at around 85Mbit/s.

You may want to check to make sure your speed test is accurate.

I am just reporting what “speedtest-cli” says.

I note that watching “htop” at the same time, on the USB-2 to Ethernet tests, the CPU is maxing out at 100 percent, so the speed is not necessarily constrained by the network interface, but the CPU’s ability to feed it, through the USB stack.

I don’t know how speedtest-cli works. If it runs a random number continuously, then we might be testing the speed of the random number generator, rather than the network. If it builds a large data table in advance and just streams the table, then it is probably representative of the fastest the system can run.

A long winded way of agreeing with you.

But, there is no doubt in my mind that the USB-2 to Ethernet interface is about an order of magnitude faster than the SPI to Ethernet interface.

One conclusion is that putting a 1Gb Ethernet interface on a PocketBeagle is a waste of money and power. A 10/100 Mb USB-2 to Ethernet interface would be cheaper, just as fast for throughput, and about one fourth the power.

— Graham

As far as using the gether gadget driver for USB, I was kind of thinking
the same thing, but I did not comment at that time. e.g. should be a lot
faster than "slow" SPI ethernet. But while on the subject, I'm thinking the
PRU's could be used as well. Either as "software" SPI interface, or perhaps
something else I'm unaware of.

When I tested gether, I tested using iperf, which seems to be "the
standard" for old school linux admins. However, with that said, I usually
prefer real world tests, as that tells me what I can expect when I use an
interface as such. Not some "mumbo jumbo" that may, or may not have
anything to do with what I'm trying to accomplish.

As far as the pocketbeagle goes . . . I do not own one, and do not
currently plan on having one any time soon. But I have tested the "bejesus"
out of the blacks, and the greens. They actually achieve better networking
speeds than most Windows based desktops / laptops. On a PC, under windows,
you'd be doing good to get 10-10.5MB/s through put over a fast ethernet
connection. On GbE, the fastest I can think of personally, was around
60MB/s and that was not constant. Do note, that I used Intel Pro NiC's . .
.but the bottleneck was, I'm thinking in the PCIe lanes of the motherboards
. . .

You’re welcome to use the picture here 1. The part can be found in this bin 2, and I modeled it after this one from eBay 3.

Thanks for the info. My USB WiFi adapter works great connected this way.

John