JavaFX and my Beagleboard xm

Post to Twitter

Inspired from the JavaOne Technical Keynote, I ordered a Beagleboard xm and all needed stuff like touch display, micro sd card, power supply and a nice looking case. I was fascinated from the features of the board and the JavaFX preview version for ARM – and it is not really expensive, of course it costs more than the Raspberry Pi (btw the Raspi will be my next project).

I developed different applications with GSM modems, push buttons (buzzers) – connected to RS232 – in the past, with desktop hardware. The applications were written in Java and used rxtx heavily. So I thought that it would be a good start to test my old applications or the RS232 communication with my new board. The next step could be a modern JavaFX UI for my old applications.

That was the idea… but first it was important to build/create the SD card for the board. I had different options because Oracle published a document about the creation of their image and Gerrit Grunwald created his own image based on the documentation. He published his files and it was possible to use his image.

I decided to build my own image because I love to hack with linux, I wanted to understand the build process and I did not want to miss the experience. To be honest, the documentation was so short and simple and I thought it should be very easy :)

Well, I won’t post all steps for the creation of my image, instead I’ll post my problems with the original guide and the differences. Start with this documentation and go to the chapter Rebuilding Ångström 12.05.

I loaded Ubuntu 12.04.1 LTS Desktop and installed it in a fresh VirtualBox VM (30G disk image is enough, but 40G is better). The installation was not very special, only standard packages. After the installation I did:

apt-get update
apt-get upgrade

I continued with the installation of important tools, as described in the documentation, but don’t forget the package gawk and please install ia32-libs-multiarch. The next steps from the documentation worked like a charm… but I had some smaller problems with my proxy. The configuration was not the problem because documentation mentions proxy setup. I’m not sure if the cause of the problem was the old squid version or an old configuration file. In order to use git through my proxy, I had to allow CONNECT to port 9418:

//new
acl git_port port 9418

//new
http_access allow CONNECT git_port
//existing
http_access deny CONNECT !SSL_ports

In my environment the http URL did not work, so I switched to https and git clone worked. During the build I had two problems. The first was a manual cancel of the build process because I pressed the wrong keys. But it was no problem to start the build again because it continued (standard make behaviour) and did not restart the whole build. The other problem was with XML parsing (xmlto/xmlling failed with docbook… fetch). The problem was gone after some experiments… I am not sure what exactly solved the problem because I installed the docbook-utils again and restarted my VM and afterwards the build continued without errors?

The Oracle documentation contains the info that the build process “takes several hours to run”. In my case and with my environment, the whole build process took about 24 hours ;-)

After successful creation of the SD card, it was time to power up the board. I did not attach a serial console and was a little bit unsure what happened, because my screen (standard LCD 19″ without touch) only showed a beagleboard image, but hurray the first start was faster than described – about 10 minutes (class 10 SD Card, 8G) – and gnome started automatically.

I continued with JDK + examples installation and verified that everything worked – and it did!

One problem was that gnome was not repainted after I stopped a JavaFX application, but maybe I should not use gnome together with JavaFX (I read this anywhere, but can’t remember).

The documentation describes that you must restart the Beagleboard xm because it is not possible to close the OGLES2Water demo… C’mon it’s linux. If you have no better ideas, simply kill the OGLES2Water process and gnome and restart gnome. That’s it.

If you are working on a windows machine, I recommend winscp for file transfers, to the board, because it is a GUI for scp. I love using vi and know ALL shortcuts (believe me ;-) ) and it is a really great tool but sometimes it is easier to use “modern” tools like midnight commander. So I installed mc:

opkg update
opkg install mc

I think it’s easier and you are faster with mc compared to the console.

After everything worked – it was time to test the serial input with some source code.

The beagleboard has a RS232 interface and I thought I could use it without problems – bad idea.
I started with the installation of rxtx:

opkg install rxtx
opkg install librxtx-java

(Add /usr/share/java/RXTXcomm.jar to your classpath and /var/lib/jni in your java.library.path)

After the installation, I used my existing serial interface java implementation and started my tests and had following problems:

  • rxtx did not find serial interfaces
  • the device name was /dev/ttyO2 and not /dev/ttyS0
  • dmesg|grep tty showed that /deb/ttyO2 was already in use

Fixed first problems with an additional system property:

-Dgnu.io.rxtx.SerialPorts=/dev/ttyO0:/dev/ttyO1:/dev/ttyO2:/dev/ttyO3

and set console=”" in my uEnv.txt to solve the last problem. I didn’t need a serial console!

The next problem was that my buzzer test application did not work because the RS232 received “no signals”. I tried to find out why and found the “problem”. The standard RS232 header on Beagleboard xm only supports RX, TX, GND (send and receive data) and all other pins are ignored or not connected. Read the documentation (BEAGLE-xM_SRM_REV_C_1_0.pdf, page 102) for the details.

So, I connected an USB to serial adapter and removed the manual serial port configuration for my application because /dev/ttyUSB0 was detected automatically. After a restart of my application, everything worked as expected.

Now I’m ready for a JavaFX application :)

Leave a Reply

Spam protection by WP Captcha-Free