# Using Beaglebone RS232 TTL cape with Beaglebone black



## French Fries (Aug 25, 2017)

Dear all,

This post is part of my FreeBSD admin station paper,
but as it is about the Beaglebone black, I prefer to post here.

I purchased years ago a dozen of RS232 capes for the BeagleBone Black.

Here is the model:
http://elinux.org/BeagleBone_TTL-RS232_Micro_Cape

Documentation is available here:
https://docs.google.com/document/d/1_mUWEFLprKzaQKn_pY9O2WO33k4wlFKaatJ2VKxDUS0/edit

At first, I thought it was plug and play, but it isn't.
Apparently, there is a need to build an overlay.
I could not use the CAP alone, just setting:

/boot/loader.conf

```
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole"
```

The cap is configured for UART0.
Do you know what need to be done to activate serial console (receiver) on this cape?

Kind regards,
French Fries


----------



## French Fries (Aug 25, 2017)

Apparently, getty is configured with 3 wire protocol:
ps aux:
`root    687   0.0  0.4  6124 1812 u0  Is+  10:26    0:00.09 /usr/libexec/getty 3wire ttyu0`


----------



## French Fries (Aug 25, 2017)

Don't reply my post, I only need to set:
edit /etc/ttys
`ttyu0   "/usr/libexec/getty std.115200"  vt100  on insecure`

Works like a charm!


----------



## French Fries (Aug 25, 2017)

In fact, it does not work "like a charm".

On host, it is configured with:
ttyu0 "/usr/libexec/getty std.115200" vt100 on insecure

On guest, I connect using:
cu -l /dev/ttyU0 -s 115200

Although I can see the whole boot log, I cannot type on the keyboard.
It displays "Connected" and that's all.

i really don't know how to debug this.


----------



## obsigna (Aug 25, 2017)

I use a FTDI to USB serial converter (3wire) for connecting to my BBB and perhaps the following does not apply to your case.

I connect the client (macOS) using: `sudo cu -s 115200 --nostop -l /dev/tty.usbserial-00000000`

Once I see Connected. in my terminal, I need to press <Enter> in order to come to the login prompt.


----------



## French Fries (Aug 25, 2017)

I can login but see no output:
login:                                                                       

`FreeBSD/arm (beaglebone) (ttyu0)                     

login: d-questions/                                 
FreeBSD Forums:        https://forums.FreeBSD.org/   

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.`


----------



## French Fries (Aug 25, 2017)

Understood ... Only root can login.
user : root
password: *****
Works very well.

Now the problem is that user "my_user" does not have sufficient rights.

Need to add:
`pw group mod dialer -m my_user`

`groups my_user
my_user wheel tty dialer`

Then my_user can connect on the target system, 
su my_user
cu -l /dev/cuaU0 -s 115200

but from the moment I connect the screen is completely blank.


----------



## French Fries (Aug 25, 2017)

The same happens from Debian client minicom instead of FreeBSD cu.

A short summary:

Machine A (client)                   ==========>  Machine B (target)
user root (to simplify)                                       

```
cu -l /dev/cuaU0 -s 115200
```
Then machine B is asking for user/password.
I can connect using root but not using my_user.

On machine B,

```
groups my_user
my_user wheel tty dialer
```

on machine B, connection is authenticated, but nothing is displayed beyond the usual greatings.

I suspect that my_user should be part of some other group to allow dialin.


----------



## French Fries (Aug 26, 2017)

Any idea?
I suspect that Group membership is needed on GPIO but I don't know how to debug.

I am going to try OpenBSD to see if a non-root account can connect on serial.


----------



## obsigna (Aug 26, 2017)

I just checked non-superuser login on the serial console to my Beaglebone Black, and it does simply work. Since it is not very clear, what exactly you are doing, I give the details of my working setup here.

My BBB is running FreeBSD 12.0-CURRENT (BEAGLEBONE) #0 r322787: Tue Aug 22 20:10:12 UTC 2017

Via ssh(1) as user root, I created the normal user rolf:
`# pw useradd -n rolf -c "Rolf" -m -s /bin/csh`

Then I assigned a password to user rolf:
`# passwd rolf`

Now, on the serial console:

```
Sat Aug 26 10:28:58 BRT 2017

FreeBSD/arm (CyStat-BBB) (ttyu0)

login: rolf
Password:
Last login: Sat Aug 26 10:24:05 on ttyu0
FreeBSD 12.0-CURRENT (BEAGLEBONE) #0 r322787: Tue Aug 22 20:10:12 UTC 2017
If you write part of a filename in tcsh,
pressing TAB will show you the available choices when there
is more than one, or complete the filename if there's only one match.
rolf@CyStat-BBB:~ % ls -l /
total 5229
-r--r--r--   1 root  wheel     6192 Feb 10  2017 COPYRIGHT
drwxr-xr-x   2 root  wheel      512 Feb 18  2017 back
drwxr-xr-x   2 root  wheel     1024 Aug 22 17:10 bin
drwxr-xr-x   9 root  wheel     1024 Aug 26 10:28 boot
dr-xr-xr-x  11 root  wheel      512 Aug 26 10:28 dev
-rw-------   1 root  wheel     4096 Aug 26 10:28 entropy
drwxr-xr-x  27 root  wheel     2560 Aug 26 10:24 etc
drwxr-xr-x   3 root  wheel      512 Aug 26 01:24 home
drwxr-xr-x   4 root  wheel     1536 Aug 22 17:10 lib
drwxr-xr-x   3 root  wheel      512 Aug 22 17:10 libexec
drwxr-xr-x   2 root  wheel      512 Feb 10  2017 media
drwxr-xr-x  17 root  wheel     1024 Aug 15 10:15 mnt
dr-xr-xr-x   2 root  wheel      512 Feb 10  2017 proc
drwxr-xr-x   2 root  wheel     2560 Aug 22 17:10 rescue
drwxr-xr-x  11 root  wheel      512 Aug 26 10:28 root
drwxr-xr-x   2 root  wheel     2560 Aug 22 17:11 sbin
lrwxr-xr-x   1 root  wheel       11 Feb 10  2017 sys -> usr/src/sys
drwxrwxrwt   6 root  wheel      144 Aug 26 10:28 tmp
drwxr-xr-x  16 root  wheel      512 Aug 26 01:24 usr
drwxr-xr-x  24 root  wheel      512 Aug 26 10:28 var
rolf@CyStat-BBB:~ %
```
The user rolf can do via the serial console everything what would be allowed by any other means of login, e.g. via ssh.

The Beaglebone Black is connected to a macOS computer using a FTDI to USB serial converter (s. attached photo).





No configuration is needed on the Beaglebone Black (target) side, and as a matter of fact, I never touched any tty settings.

On the Mac (client) side, the only difficulty is too find out the identifier of the USB/tty device:

```
$ ls -l /dev/tty.*
crw-rw-rw-  1 root  wheel   20,   2 26 Aug 09:40 /dev/tty.Bluetooth-Incoming-Port
crw-rw-rw-  1 root  wheel   20,   4 26 Aug 09:40 /dev/tty.Rolf-WirelessiAP
crw-rw-rw-  1 root  wheel   20,   0 26 Aug 10:40 /dev/tty.usbserial-00000000
```
Here it is /dev/tty.usbserial-00000000, and even as it got rw set for everybody, the macOS 12 does allow only the superuser attaching a terminal to it, therefore, I need to use sudo on the client side for establishing the serial connection:
`sudo cu -s 115200 --nostop -l /dev/tty.usbserial-00000000`


----------

