Feb
17 Re-Flashing an Arduino
Accidently I managed to use a reset method from the watchdog
functionalities in the setup-routine of my Arduino code. It was reseting
about 4 times per second and I was not able to upload new code.
Searching for a method to re-flash the bootloader of my Arduino, I found
a very helpful and easy tutorial:
Arduino
Diecimila / Burning the Bootloader without AVR-Writer
It describes how to solder a 4-pin-header to the Diecimila-board and use
the so called BitBang mode of the FT232RL to burn a new bootloader
without an external AVR-Writer. It also provides a program, called
avrdude-serjtag (which is unfortunately only running on Windows, but
ok...). So if you have a solder-iron, a windows-pc and some pin-headers
and wires, you can extend your Arduino board easily to burn a new
bootloader (and it's cheap!!).
So my Arduino is up and running fine again.
Categories:
Permalink
Feb
07 Installing Ubuntu 8.04 on a Mac mini (G4 PowerPC)
I'm using my old Mac mini (a G4 PowerPC version with 512 MB RAM) mainly
for mail and browsing the internet. Sometimes I use iMovie or other nice
video tools, that only work nice on a mac.
Last year I upgraded from Tiger to Leopard (MacOS X 10.5). It works
fine, but compared to my x86 laptop running Ubuntu it feels a bit slow.
So last weekend I decided to clean up the hard disc of the Mac mini and
installed Ubuntu, which worked surprisingly well (I did this the first
time!). In this small howto I describe the procedure.
After cleaning and backing up (I got about 13 GB free disk space) I
downloaded the Hardy (8.04) LiveCD (I'd upgrade to Intrepid later, but
there was no LiveCD) from the community
ports of Ubuntu. Yes, PowerPC is not supported officially by Ubuntu
anymore, but the community seems to do a great job!
Pressing the "Alt" key while rebooting I was able to boot from the
burned CD. But with the standard "live" boot, my display kept black and
the system was not usable. Searching the net, I found a thread,
that tackles this problem. It says that I have to boot with additional
kernel parameters:
live-nosplash-powerpc modprobe ide-core
video=radeonfb:1024x768-24@60
Now the system came up and was usable.
At first I had to resize the old OS X partition which almost spread over
the whole hard disk. This could be easily done using GParted. Again be
warned to backup all your data on the partition you could lose
them!!! You do that on your own risk!
I resized the partition to get about 9 GBs of free space on the disk.
The resizing process took quite long, so don't panic, if it seems to
take too long. Just be patient.
After successfully resizing the OS X partition, I installed the Ubuntu
system into the free space of the disk. I was surprised that the boot
manager "yaboot" was installed automatically and totally correct with OS
X and Linux as a dual boot.
When the installation was done, booting into the new system was no
problem and everything seemed to work. Now it was the time to upgrade to
Intrepid Ibex (8.10). This could be done by running
sudo update-manager -d
in a terminal. This also worked well. Now even compositing works with
nice desktop effects. Finally I got a nice Ubuntu system running on my
Mac mini beside MacOS. :-)
I hope this helps you to speed up/resurrect your old mini, too.
For additional information on Ubuntu on PowerPC have a look at the Ubuntu
Installation Guide.
Categories:
Permalink
Feb
02 HowTo: XCF ActiveMemory
In my diploma (respectively master) thesis, I'm using XCF,
a C++ middleware developed at the Bielefeld University. This
communication framework is quite good and versatile. It offers
publisher/subscriber data streams, XML-RPC and content driven event
notification through the so called "ActiveMemory". The ActiveMemory is a
XML database, that routes all communication between nodes based on the
content of the data streams. This makes it easy to publish or subscribe
data and react on the occurrence of particular content.
Unfortunately, the documentation of the ActiveMemory is a bit sparse,
which makes getting started a bit complicated. In the extended part of
this posting (just click on its headline) I'm going to explain how to
use the ActiveMemory quite easily and comfortable.
I assume that there already is a valid XCF installation on the target
Linux system and you have some basic XCF programming skills (after going
through the tutorials
you have these). The HowTo is divided into three parts:
-
Setting up an ActiveMemory
-
Accessing and inserting data into the ActiveMemory
-
Subscribing on content
Setting up an ActiveMemory
To run an ActiveMemory, you need a running dispatcher (included in the
XCF framework). It should be running after simply executing "dispatcher"
from the XCF bin-directory.
Before starting the memory server, you also need to run "spread". This
requires a valid configuration file in your home-directory, called
"spread.conf". This file keeps all nodes, that should be able to access
the ActiveMemory:
Spread_Segment 127.0.0.255:4803 {
localhost 127.0.0.1
leonardo 127.0.1.1
}
The code above show my local spread.conf, where leonardo is the host
name of my system (you might want to adapt it to the hos name of your
machine). To let more nodes access the ActiveMemory, just add thier host
name and IP between the brackets, one node per line. Finally start
"spread".
Now create a directory where the database of the ActiveMemory can place
it's content. For first experiments it is sufficient, to create a
directory in the /tmp path of your machine, e.g. call "mkdir
/tmp/dump/". After creating the directory, you can start the memory
server "memory_server" with this path and the desired name of the
ActiveMemory as arguments. For example call "memory_server /tmp/dump
MemoryName".
Now you should have successfully set up an ActiveMemory.
You can also write two simple bash-scripts, one that starts these three
programs and another, that kills them and cleans up:
"am-start.sh":
dispatcher &
sleep 2
spread &
sleep 3
mkdir /tmp/dump
memory_server /tmp/dump/ MemoryName
"am-stop.sh":
killall dispatcher
killall spread
killall memory_server
rm /tmp/4803
Accessing and inserting data into the ActiveMemory
To get access to your ActiveMemory instance, you need a
MemoryInterface::pointer:
memory::interface::MemoryInterface::pointer mi;
mi = MemoryInterface::getInstance("xcf:MemoryName");
Now you should have an open connection to your ActiveMemory. With the
insert method you can insert XML data:
// Creating some dummy data:
Location root("<data></data>", "/data");
Location foo("<foo>", "/foo");
foo["value"] = 123;
root.add(foo);
// inserting the data:
mi->insert(root.getDocumentText());
See documentation for
more access commands.
Subscribing on content
For convenient access Alex found a nice encapsulation concept. He
created a class that encapsulates the binding of a callback function
using boost and the callback function itself. Here is the code of the
header file "amcalladapter.h":
#ifndef AMCALLADAPTER_H
#define AMCALLADAPTER_H
#include <xcf/xcf.hpp>
#include <xmltio/xmltio.hpp>
#include <Memory/Interface.hpp>
#include <boost/bind.hpp>
#include <string>
#include <iostream>
class AMCallAdapter {
public:
AMCallAdapter(std::string memory, std::string xpath);
virtual void callbackFunc(memory::interface::Event e);
protected:
memory::interface::MemoryInterface::pointer m_mi;
std::string m_memory;
std::string m_xpath;
};
#endif
Additionally you need the source file "amcalladapter.cpp":
#include "amcalladapter.h"
using namespace std;
using namespace memory::interface;
using namespace boost;
using namespace xmltio;
AMCallAdapter::AMCallAdapter(string memory, string xpath){
m_memory = memory;
m_xpath = xpath;
m_mi = MemoryInterface::getInstance("xcf:" + memory);
Condition con(Event::INSERT|Event::REPLACE, xpath);
TriggeredAction action(bind(&AMCallAdapter::callbackFunc, this, _1));
m_mi->add(con,action);
}
void AMCallAdapter::callbackFunc(Event e){
TIODocument doc = e.getDocument();
Location root = doc.getRootLocation();
cerr << "WARNING: You are using a useless class!" << endl <<
"Memory: " << m_memory << endl <<
"XPath: " << m_xpath << endl <<
"Document: " << root.getDocumentText() << endl <<
"You have to derive a new class from CallAdapter" <<
"and overwrite the callbackFunc!" << endl;
}
In the instantiation of the Condition you can specify on which type of
event you want the callbackFunc to be subscribed. In the example the
types insert and replace are linked (according to boolean terms) so that
the callbackFunc gets called on insert and replace events.
Now you can simply derive a new class from this stub and reimplement the
callbackFunc to your needs. Every time, a xml document with content, the
AMCallAdapter class takes out a subscription on, the callbackFunc gets
called. When using other frameworks, like Qt, that implements event
handling, this could be used to emit signals. But be careful with
signal-slot connections between threads. These need to get queued.
Now you have a basic and very convenient method at hand to use an
ActiveMemory.
Categories:
Permalink