# BeagleBone Black ethernet over USB



## David Wijnants (Nov 23, 2015)

My first post: How do I go about setting up ethernet over the BeagleBone Black micro USB cable instead of using the normal RJ45? (The switch, extra cables and heavy power adapter take up a lot of space.) I'm using a snapshot of CURRENT, which works well.

Thanks,
David.


----------



## Phishfry (Nov 23, 2015)

Actually the microUSB is for OTG host and power only, not periphery.
The single full sized USB Female "A" jack is what is used for accessories and I use a dlink powered USB hub, that uses separate power to each jack.
dlink DUB-H4---The older one that is mostly silver---
You could probably use an external USB ethernet adapter for an additional LAN port. I have Wifi and 4G running via USB.
The board is picky about powered hubs. Read the internets.


----------



## David Wijnants (Nov 23, 2015)

Yes I can see that would be the preferred solution for a USB network adapter if you haven't got a real network card.

But I'm referring to the basic setup for doing ethernet over the power/microusb cable as the BBB does with its pre-loaded Debian. When you take the BBB out of the box, you plug it into the USB, install the Windows drivers and get going. Just one cable.

Only I'd rather use BSD than Linux. So I'm trying to guess what the interface would be called, e.g. xy0.

Thanks again,
David.


----------



## Phishfry (Nov 24, 2015)

Check out the default Linux and see what it shows up as in Linux logs. The OTG port is similar to UART so maybe uart0. Maybe do some FreeBSD hotplugs and check your dmesg  log.

** Sorry I see your expecting Windows to work like the Element14 setup and it will not look anything like that. No autoloaded config screens or web access pages.**
Just Bare Bones.
Welcome Aboard.


----------



## David Wijnants (Nov 24, 2015)

Thanks. I doubt it's uart. I recall from Googling "FreeBSD BeagleBone ethernet USB" and variations that the black specifically does not have serial over the USB. (I'm attached to the UART pins next to P9 so at least I know it booted.)

I also SSH across the RJ45 with the help of a bulky power adapter, cables and switch. But it's a big nest of cables.... I can SSH to Debian across the micro USB.

** Thankfully none of that web access nonsense.  **


----------



## Phishfry (Nov 24, 2015)

You should be able to SSH across the OTG port as well in FreeBSD if you find the correct port. No bonescript or cloud9 IDE's.


----------



## David Wijnants (Nov 24, 2015)

Not sure there's an interface. ifconfig only shows loopback (lo0) and the ordinary network port (cpsw0). I don't know the name of the OTG interface/driver to try and bring up. I've tried various u's and (r)ndis as guesses. Not much help from Google.

No need for bonescript or cloud9. I type my C into vi.


----------



## Phishfry (Nov 24, 2015)

Here is a little something about the OTG port.

https://lists.freebsd.org/pipermail/freebsd-usb/2013-July/012195.html

This deals with Gonzo trying to get it working in host mode.

https://lists.freebsd.org/pipermail/freebsd-drivers/2015-June/001821.html
From this post it looks like it is working


----------



## Phishfry (Nov 25, 2015)

You connecting via usb an FreeBSD x86/64 computer to your FreeBSD-Beaglebone correct? That would probably be best until you get it figured out.
The Debian OTG device might show up differently than FreeBSD's driver implementation under Windows is why I say that.
Even Debian Desktop connected to BBB-FreeBSD might not work due to same issue...

You can contact Gonzo as he is a nice guy. He has a blog and he is in the forum news section for ARM stuff all the time.
Please share with us if you find out. Have you studied your dmesg logs good? I am interested in using this -seeing that the port driver goes both directions it appears.


----------



## Phishfry (Nov 25, 2015)

OK I just tested this for you and this what I get:

```
Nov 23 12:02:09 beaglebone login: ROOT LOGIN (root) ON ttyu0
FreeBSD 11.0-CURRENT (BEAGLEBONE) #0 r289846: Sat Oct 24 02:04:31 UTC 2015

Welcome to FreeBSD!

Edit /etc/motd to change this login announcement.
root@beaglebone:~ # ugen0.2: <FreeBSD foundation> at usbus0
ustorage_fs0: <USB Mass Storage Interface> on usbus0
```


----------



## Phishfry (Nov 25, 2015)

When connected the other side shows up as:


```
da0:<FreeBSD File-Stor Gadget 0101>Removable Direct Access SCSI-2 Device
```

On my Dell Laptop with FreeBSD11-Current from late August 2015.


----------



## Phishfry (Nov 25, 2015)

So to interpret that for you. The Beablebone is showing up as an Mass Storage device to an FreeBSD connected computer. That means I could mount da0 and send files to it.
I am not sure if a serial/usb console exists as I previously though it did. If it does you may need to coax the port out with sysutils/usb_modeswitch


----------



## Phishfry (Nov 25, 2015)

Did you note the restrictions on the device. 100ma max. and very few endpoints. This means few devices. Like maybe good for a mouse.


----------



## David Wijnants (Nov 25, 2015)

Thanks for all that! I did a lot of rummaging around last night, comparing and contrasting FreeBSD and Debian. dmesg on the BBB acknowledges the existence of the OTG hub but it doesn't look like anything is attached. I played around with usbconfig a bit but the only useful info I found was the normal USB slot (plugging in a stick resulted in an ad0, which I could mount as ad0s1).

It turns out that although there is no built-in serial over USB, when you boot the BBB's default Debian, it does show up in Windows as a COM port, through which I can log in (this is in addition to the network interface and storage device over the same cable, as well as the six pin header).

So when Linux boots, the BBB identifies itself to Windows as a storage device, a network interface and a serial line. When FreeBSD boots it only identifies as a storage device, but Windows offers to format it (No!).

It looks like everything is there in FreeBSD, but it's not identifying itself on startup.

I'm not sure where the Windows drivers come from, but they're on http://beagleboard.org/getting-started - the Windows device manager lists them as "Linux Community".


----------



## David Wijnants (Nov 25, 2015)

This might be useful for the kernel developers (perhaps):

http://elinux.org/Beagleboard:BeagleBoneBlack
http://elinux.org/BeagleBone_Community

It describes the OTG hub as being capable of ethernet as well as serial.



> The mini-USB type-A OTG/device *client-mode* socket is multi-functional. In addition to providing an alternative source of power, it gives access to an on-board front-end two-port USB client-side hub. (This is not related to the separate *host-mode* USB socket described later). One port of the hub goes directly to the *USB0* port of the TI AM3358/9 SoC, while the other port connects to a dual-port FTDI FT2232H USB-to-serial converter to provide board-to-external-host serial communications and/or JTAG debugging. The BeagleBone's Linux serial console is available through this USB serial connection.
> 
> The SoC's *USB0* connection to the front-end hub works in one of two modes, and you can toggle between them at any time: it either presents the SD card as a mountable USB storage device to the host, or it provides an Ethernet-over-USB networking interface which yields a simple method of quick-start. The Ethernet-over-USB facility is additional to the BeagleBone's normal 10/100 Ethernet interface, which is directly implemented in the SoC rather than hanging off USB as in some other designs. Full IPv4 and IPv6 networking is provided by the supplied Linux system out of the box.
> 
> In addition to the USB OTG Device or *client-mode* facilities already described, BeagleBone also provides one *host-mode* USB type-A socket on the other end of the board. This is driven from the *USB1* connection on the AM3358/9 SoC, and provides access to USB host peripherals such as mice, keyboards, storage, and wifi or Bluetooth dongles, or a USB hub for further expansion.


----------



## David Wijnants (Nov 25, 2015)

Phishfry said:


> If it does you may need to coax the port out with sysutils/usb_modeswitch



I'll have a go at that tonight.


----------

