Connecting to Raspberry Pi with FreeBSD using a Console Cable

First time I connected HDMI display and keyboard to my Raspberry Pi.
SDIM6513

HDMI display works as a console. You can see all diagnostic messages on it.
But it is hard to make good screenshots from it.
That’s why I decide to use serial connection to my Raspberry Pi.

I use Console Cable from Adafruit.
I connect green wire to RXD (GPIO 15), white wire to TXD (GPIO 14) and black wire to GND.
I don’t connect red wire to 5V as I use USB for power Raspberry Pi.
SDIM6524

Adafruit provides good tutorial “How to Connect to your Raspberry Pi with a Console Cable“.

But there are some specific points for FreeBSD.

First, by default /etc/ttys comes with terminal type “dialup” for serial device.
6

It works for simple operations like entering commands.
But it is not usable for screen oriented operations like vi.
We need just to change terminal type to vt100:
7

Second, this serial connection is just serial terminal, not serial console.
System messages will go to the HDMI display, not to our serial connection.
To change that we need to add some configuration strings to file /boot/loader.conf:
boot_multicons="YES"
boot_serial="YES"
console="comconsole, vidconsole"
comconsole_speed="115200"

17

That’s all folks

UPDATE

Recently in FreeBSD 10 Stable snapshots appeared new console device – vt(4).
The first time I noticed this in the r268038 version:

sc01

So, we don’t need additional strings for /boot/loader.conf anymore.

Advertisements

9 thoughts on “Connecting to Raspberry Pi with FreeBSD using a Console Cable

  1. Hello, thank you very much for this. I need to use the rx tx pins as a normal serial ttl, so the question is: how can I do it? And: what will be the name of the serial device (in Raspbian is /dev/ttyAMA0) to be used by user programs?
    Thank you again, regards
    Luca

    • If you don’t want to use serial device for serial console and want to use it for transferring data, you should do this:
      1) Edit /etc/ttys file and change “on” to “off” in the line starts with ttyu0
      2) Restart init(8) by command “kill -HUP 1” (under root account)

  2. I’ve tryed changing only /etc/ttys file but I still see the booting messages. The only difference is that the system does not prompt for a login, it seems that only getty has been disabled.

    My /etc/ttys configuration file is:

    root@raspberry-pi:/etc # cat ttys
    ttyv0 “/usr/libexec/getty Pc” xterm on secure
    ttyv1 “/usr/libexec/getty Pc” xterm on secure
    ttyv2 “/usr/libexec/getty Pc” xterm on secure
    ttyv3 “/usr/libexec/getty Pc” xterm on secure
    ttyu0 “/usr/libexec/getty 3wire.115200″ vt100 off secure

    My /boot/loader.conf configuration file is:

    root@raspberry-pi:/etc # cat /boot/loader.conf
    boot_multicons=”YES”
    boot_serial=”YES”
    console=”comconsole, vidconsole”
    comconsole_speed=”115200″
    legal.realtek.license_ack=1
    if_urtwn_load=”YES”

  3. In addition to the last comment, I tryed to use minicom but it seems that the ttyu0 is blocked:

    root@raspberry-pi:~ #
    root@raspberry-pi:~ # ls -l /dev/ttyu*
    crw——- 1 root wheel 0x1f Dec 9 13:08 /dev/ttyu0
    crw——- 1 root wheel 0x20 Dec 9 13:08 /dev/ttyu0.init
    crw——- 1 root wheel 0x21 Dec 9 13:08 /dev/ttyu0.lock
    root@raspberry-pi:~ #
    root@raspberry-pi:~ # minicom -b 115200 -D /dev/ttyu0
    minicom: cannot open /dev/ttyu0: Permission denied
    root@raspberry-pi:~ #

    • Yes, I see the same files in /dev directory. When we change ttyu0 to “off” in /etc/ttys file, we disable getty on this terminal.
      But we can use it.
      I don’t have minicom yet. I used cat.
      To output we can use “cat file > /dev/ttyu0”.
      To input we can use “cat < /dev/ttyu0".
      It's works.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s