fredag 14 september 2012

Setting up Olimex arm-usb-tiny-h with Ubuntu 12.04

Along with the Olimex E407 board, I also ordered an Olimex arm usb tiny h JTAG to be able to program the board. I am more convenient with working in Linux than other operating systems so I really wanted this to work with my Ubuntu 12.04 (32bit x86) installation.

This was a bit tricky, and it has taken some time to Google for all the bits and pieces that finally made it work.

First I downloaded libftdi 0.20 from here: http://www.intra2net.com/en/developer/libftdi/download.php
Build it with the normal series of auto tools commands:


$./configure
$make
$sudo make install


I am not sure if both are needed, but to be on the safe side I downloaded the ftd2xx driver and installed it as well. You can get it here: http://www.ftdichip.com/Drivers/D2XX.htm. Copy the libftd2xx.so.1.1.12 and libftd2xx.a to /usr/local/lib and make symlinks with the names libftd2xx.so and libftd2xx.so.1

I downloaded and compiled openOCD 0.6.0 from here http://openocd.sourceforge.net/ and build it with:

Note: See updated instruction regarding patch below!
$./configure --enable-ftdi --enable-ft2232_ftd2xx

$make
$make install

When plugging in the arm-usb-tiny-h, you will not be granted access by default. To handle this you have to create a rule for udev:

$cd /etc/udev/rules.d

As root, create a file named 99-olimex-arm-usb-tiny-h.rule with this content:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002a", MODE="0666"

I also removed the brltty package which might interfere with some of the ftdi drivers, but this was only a precaution. You could try running without removing it.

$sudo apt-get remove brltty

Now I run openOCD with the following command (paths relative from where I built openOCD):

$openOCD -f tcl/interfaces/ftdi/olimex-arm-usb-tiny-h.cfg -f stm32f4x.cfg

You can download the stm32f4x.cfg from Olimex web site.

Good luck!

Update Sept 17 2012
Apply the patch provided by this site: http://pastebin.com/rdFF2eZd before configuring and buildng openOCD

måndag 2 april 2012

Ssh-agent on Linux Mint 12

I have had som struggle setting up ssh agent to work with my Linux Mint machines. Both are running Linux Mint 12 and are fairly recently installed. What I want to do is to be able to log in from one host (called vader) on the other (called leia) without having to enter password every time and I don't want to generate keys with empty passwords.

First of all, I discovered that on Linux Mint 12, the firewall is turned on by default which prevented me from loging on to 'leia' with ssh. So, make sure your firewall is letting traffic through on port 22.

Now, generate keys as usual on your local host and enter a password for them:


vader$> ssh-keygen -t rsa

Install the public key on the host you want to connect to:
ssh-copy-id -i @


In my case, it looks like this:
vader$> ssh-copy-id -i ~/.ssh/id_rsa.pub peter@leia

Now, it is time to load your key into memory. This is done with the program ssh-add, but first you have to start an instance of ssh-agent.
vader$> ssh-agent bash
vader$> ssh-add

The ssh-add command will automatically load ~/.ssh/id_rsa into the agent and ask you for the password you've set. From now on I don't have to enter a password when logging in to leia, as long as I stay in the ssh-agent shell.

Good luck!

fredag 23 mars 2012

Windows Temp folder prevents Eclipse from starting

Since a couple of months I have had the pleasure of working on a Google Web Toolkit (GWT) project. Google have produced a range of quite well integrated tools for it an it is quite a smooth experience, even on an embedded platform such as the one I am working with.

Unfortunatelly, it seems that the Google Plugin for Eclipse (GPE) relies heavily on the users local Temp folder in windows, and generates quite a lot of files to it. After a couple of months, first eclipse, then MinGW, simply wouldn't start. Or sometimes i took hours to get it working. It turns out that you can't have too many files and folders in a folder, and there is no mechanism in Windows (that I know of) to automatically clean out the Temp folder or even give a warning when it becomes full. If the Temp folder gets full, it prevents some programs from operating correctly.

Solution: Delete the content of the Temp folder ("C:\Users\'your user name'\Appdata\Local\Temp" in Windows 7). It's as simple as that.... and it worked like a charm for me.

Good Luck

fredag 25 mars 2011

Hp 3210 URL for scanning

I have a Hp 3210 printer/scanner/copier. It works perfect with Ubuntu, but everytime I have to set it up for scanning i run into problems finding out what parameters I need to start xsane. Here's how to find the url:

Use the program hp-makeuri to generate the uri
$ hp-makeuri 192.168.1.20
the result is in my case:
SANE URI: hpaio:/net/Photosmart_3200_series?ip=192.168.1.20

Now xsane can be started with the uri as parameter:
xsane hpaio:/net/Photosmart_3200_series?ip=192.168.1.20

torsdag 24 mars 2011

xmlHttpRequest.status=0

Hi everyone!
This will be a short one, but I just came across some problems during the process of learning javascript again. It's a long time since I worked with client side web technology, so it's fun to discover how far things have come during recent years.

Anyway, in my effort of building a GMail Contextual gadget i have to send some data to a http server using xmlHttpRequest. The gadget runs in an iFrame which will stop you from using xmlHttpRequest. It's called cross domain blocking or something. So the first you'll have to do is to short circuit the cross domain blocking by adding the header "Access-Control-Allow-Origin: *" to the response.

In php:

header('Content-type: text/html');
header('Access-Control-Allow-Origin: *');
...

If you don't do this you will inevitably get redystate=4 and status=0 (or 'unknown' or something) for the xmlHttpRequest object.

The second mistake i made was the trigger button for the request. Using a submit input and the onClick event will generate two callbacks. One to the forms action, and one to the actual function you specified in the onClick. This messes things up and you're back with status=0 problem again.

Solution: Use input type="button". This input will not trigger the forms actionl.

Example:

<form name="fakeform" action="return false;" >
<input type="button" value="Go" onClick="doRequest();" />
</form>


Here is a good example of how to write the doRequest function: http://stackoverflow.com/questions/247483/http-get-request-in-javascript

Good luck!

torsdag 9 juli 2009

Google Sites

I mina försök att tränga djupare i Googles tekniker och produkter har turen kommit till Google Sites, en onlinetjänst för att skapa egna websidor. Inte så dumt faktiskt... MEN... Inte så färdigt och integrerat med andra googleprodukter som man kunde hoppats.

Google sites är enkelt att använda och man kommer snabbt in i hur man lägger till s.k. gadgets i sidan. Det är precis samma gadgets som används på iGoogle. Så långt allt bra. Vad jag skulle vilja se mer av är bättre integration av Google Groups, Blogger och liknande produkter. Det skulle ge en bättre möjlighet att skapa riktiga "portaler" för sina egna projekt och liknande.

När man granskar videos kring Sites verkar det helt klart vara möjligt att skapa den sortens innehåll, och det kan ju vara jag som missat nåt, men då kan man väl konstatera att det är för svårt att göra innehållet riktigt bra.

måndag 6 juli 2009

RSS

Igentligen är det här inget annat än ett försök att upptäcka nya tekniker. Det kommer ju mycket nu kan man säga. I mitt yrke som utvecklare inom "embedded systems" blir man lätt lite insnöad på elektroniken, och då är det lätt att hetare tekniker drar ifrån.

Det hela började med att jag experimenterade en del med RSS-feeds. Feeds är ju som sagt inte något nytt, men jag har inte riktigt intresserat mig för deras existens mer än att jag lagt till en eller annan i min browser för att följa nyheter där. Det är väl gott och väl. Men så provade jag att lägga till feeds i outlook, och se vilken skillnad det blev!!!

Helt seriöst... jag trodde nog inte att rss-läsarens utformning skulle ha så stor inverkan på informationsflödet. Effektivitetsskillnaden i att kunna se vilka feeds man läst och inte är enorm. Jag tänkte genast att det här kanske är en bra metod att använda i utvecklingsgruppen på jobbet, så jag slängde upp en RSS-kanal på samma webserver som vi har vår wiki och länkar nu alla feeds till sidor på wikin. Det funkar huur bra som helst!

Nu slipper medlemmarna i min grupp aktivt gå in och kolla om det finns uppdateringar de borde ta del av på wikin, det kommer de se i outlook! Tyvärr saknar jag något bra linuxbaserat verktyg för att publicera rss-kanalen. Gör det manuellt än så länge.