Results of serial port tests

I tested the serial ports with non-canonical and canonical input mode as well as synchronously and asynchronously. I did not encounter any heavy problems related to FIFO overflows, but there seems to be a limitation with canonical input mode:

Synchronous Serial Port Communication

Even when writing 20000 messages all at once with the maximum baud rate supported by the temios API (B230400) to all four serial ports there were no messages dropped! Reading from the port and writing to a log file all happens synchronously, but the driver seems to take care of pretty much everything. Reading one byte or multiple bytes from the serial buffer does not seem to make a difference and both perform good. I tested this with non-canonical input mode; with canonical input mode (see other branches) I was able to separate the log into single messages devided by their time stamps. When doing this it is easy to find out the limitations of the built in buffer: The serial device can send up to 4096 characters without a line break. But if it sends more, the first messages which arrived will be dropped as the buffer fills up. That makes sense, as one page is 4096 bytes large. To overcome this issue later the user of the serial terminal server should be able to select non-canonical mode. That way the buffer can be read in time. Another possibility would be to use non-canonical mode per default and divide the logs manually after each \n character.

Asynchronous Serial Port Communication

This was tested with canonical mode and led to the same results as with synchronous serial port communication. The same limits apply, but inputs can be handled without needing to spawn a new thread for I/O tasks. This can be an improvement for the serial terminal server implementation, as I would like to avoid blocking the UI thread.

Results of serial port tests

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