Testing the serial port

To get to know how to access serial devices I decided to write some simple test code. I connected an Arduino board to the UART1 port of BeagleBone Black as seen here.

Wiring Arduino and BBB


To enable the UART1 port I openedĀ /etc/default/capemgr in vim and added the following line to the bottom:

vim /etc/default/capemgr
# Options to pass to capemgr

enable uart ports on wheezy

To enable the UART1 port I opened /boot/uEnv.txt in vim and added the following line to the bottom:

vim /boot/uEnv.txt
##Enable UART ports

So tail gives the following:

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync

##Enable UART ports


Communicating through uart

I then wrote some Arduino code which sends 5000 messages to the UART port. On the BB I read the messages using the termios API (see man termios ) and write each message with a tag (time, date) to a file. Currently, everything works fine, but I think if there should arise any issues in terms of performance making the file writing and port reading asynchronously (possibly also using IO interrupts via SIGIO?) should give the whole process more performance.

The code can be found in my GSoC preparation repo


How to wire the Arduino to the BBB for testing purposes
Testing the serial port