Enable UART on Cubieboard with Lubuntu

I wanted to connect my cubieboard with lubuntu to my arduino via serial communication. For that I had to enable a UART and connect pins to my arduino (only RX/TX is needed). I have arduino mini 3.3V on which I have attached some sensors (outside temperature).
By this command you can check if the port is enabled:

stty -F /dev/ttyS0 -a

In fresh installation of lubuntu the ttyS0 is configured and used by kernel and ttyS1 is not enabled. You will get this message for ttyS1:

stty: /dev/ttyS1: Input/output error

I followed the how-to by cubieboard.

sudo mount /dev/nanda /mnt
cd /mnt
sudo bin2fex script.bin script.fex
sudo vi script.fex

I changed only 1 uart – I selected the one that is using only 2 pins uart_para4:

[uart_para4]
uart_used = 1
uart_port = 4
uart_type = 2
uart_tx = port:PG10<4><1><default><default>
uart_rx = port:PG11<4><1><default><default>

I use mc for as easy text editor

save and convert fex file back to bin file:

sudo fex2bin script.fex script.bin

restart to have new UART visible in lubuntu:

sudo reboot

You can find the pin definition on cubie site.

For my case I have configured in script.fex file port PG10 as tx and PG11 as rx which are pins 17 and 18 on the connector on USB side.

17 PG10 (CSI1-D6/UART4-TX) 18 PG11 (CSI1-D7/UART4-RX)

 

I have attached cables (I have 2.54mm ones, but they somehow fit). I used 3.3V from the front side of cubieboard but I could used also PIN 44 next to SATA port.

Pin 17/18 for RX/TX and PIN19 for GND

Arduino mini pro 3.3V

The device number of ttySx depends on how many uarts you have opened. In my case I have opened uart0 and uart4, so the uart4 is mapped to the device ttyS1.

To test my changes I used utility called “cu” that I have installed and started on ttyS1 with 9600 baud rate.

 

sudo apt-get install cu
cu -s 9600 -l /dev/ttyS1

Arduino was programmed to send me outside temperature (in C) and humidity so I started to receive data.

Now I will setup a crontab and a web server to have history of temperature available on the internet. I will do another post, because it took me a while to create such graph on my web page hosted on Cubieboard2 with Apache.

Outside temperature for last 4 days using Google charts API


Related Posts

DLNA media server on Cubieboard with Lubuntu

I have installed Lubuntu on my new Cubieboard 2. I have also attached HDD to SATA so I have more space to store my media. This posts describes the steps needed to install and configure[…]

Continue reading ...

Cubieboard with BMP085 Barometer, Alittute, Temperature

I’ve bought  BMP085 barometric pressure sensor and my goal was to get pressure and temperature data via I2C interface to my Cubieboard running linux (cubieboard2-lubuntu-installation).

Continue reading ...

Cubieboard2 – Lubuntu – Xterm Copy/Paste

As you can find out the normal copy paste is not working in Lubuntu Xterm.This blog: http://www.davidsimmons.com/soft/xtermhacks/ looks to me too complicated. I just have to get used to my mid mouse button that will copy+paste the[…]

Continue reading ...