July 2, 2008

The Mist and The Ruins… 70s nihilism all over again

Category: Blah blah — em @ 02:25

NB. Expect this post to be edited to death…

After saying just the other week to Jennimi (who has retired from blogging for the time being) that I had also largely given up - mainly because whatever I write seems to consist of a rant - I present… another rant.

Sorry.

But recently, it seems that every second novel I pick up is awful, and every second movie is dire. In particular: two (2) nihilistic and daft pieces of horror. Let’s look at the apparently bestselling book ‘The Ruins’, and the movie version of ‘The Mist’.

The first of these I picked up in Canada on the way to Pittsburgh a fortnight ago. According to the cover, it’s a compulsively readable novel that’s virtually impossible to put down once you start it. I’m going to have to disagree with that. After fifty pages, I put it down and went swimming. Got through the rest during various connecting flights the following day. The guy sitting next to me on one plane looked at the book and asked, “Hey, how is that book? I got it a month ago, I’m on page twenty.’

I’d just finally reached the last page - yielding, as one might say, the final tortured spark of attention - and I closed the book, folded it into the seat pocket and said, ‘I wouldn’t recommend page twenty-one.’ I don’t, by the way, for several reasons, and neither do a whole load of other people. If you want to see social conflict in action, take a look at Amazon scores for this book:

5 star: 20% (194)
4 star: 16% (158)
3 star: 14% (136)
2 star: 17% (172)
1 star: 31% (297)

The plot is pretty simple. A bunch of cardboard cut-out characters (and a German named Mathias, which is somewhat inexplicable given that Germans spell the name with two t’s) head off into the jungle in search of Mathias’ brother, accidentally cross the wrong boundary and end up stuck on a hill full of lush greenery which - spoiler warning - is both carnivorous and hungry. The vines will, eventually, eat the lot of them. In some cases it will also be responsible for their deaths, although according to the rules of all disaster stories since ‘Lord of the Flies’, the characters are insanely neurotic and dangerous to themselves and each other to the extent that the vine has pretty much nothing to do but sit back and make noises like a mobile telephone - I kid you not, the plant is a ventriloquist. It never actually sings any of the ‘Little Shop of Horrors’, but now that you mention it this is probably a youtube fan movie just waiting to happen. Anyway, the major points here are that the characters are unlikeable and virtually without personality, and they all die messily.

The Mist gets slightly less polarised ratings, but all the same, you can see quite a spread of opinion in there:

5 star: 34% (95)
4 star: 24% (68)
3 star: 16% (46)
2 star: 11% (32)
1 star: 12% (35)

Superficially, the two stories share many similarities. True, in the one case the kids come to the disaster. In the case of The Mist, the characters just happen to be visiting the same supermarket at the time that the Evil ExtraDimensional Mist comes to call, so their role in establishing the situation is more passive - except it isn’t, because as is pointed out, it’s really the fault of the Army and their bosses for Playing Silly Buggers With What Man Ought Not To Wot Of. Anyway, the mist contains a very large number of evil horror/fantasy-movie cliches: the tentacles you see in Tremors before you discover that they actually belong to a carnivorous earthworm; the gigantic spiders that spawn their unholy children in the unwilling bodies of their victims (a la digger wasp, Van Vogt’s Discord in Scarlet, the Aliens series, etc); massive great insects and pterodactyls, of which there is no shortage in the literature. People who go outside end up dead. Those who stay inside end up committing suicide, converting to religious extremism and sacrificing a soldier in order to appease the big, evil bugs. Also, and this is where the story really diverges from the Stephen King novella on which this is based, they all die. Except for the one guy, who after kindly euthanising the leftovers of his family and friends, runs out of bullets and is rescued despite his own best efforts. In the original - as is almost always the case with Stephen King - the novella ends by injecting a note of hope.

IFC film news calls The Ruins “the extreme end of that growing “Hostel”/”Turistas” subgenre of films embodying America’s suspicions that everyone else in the world would like to violently kill us — in this case, even the local plant life.” In the case of The Mist, of course, it’s the fauna rather than the flora, but as one reviewer on IMDB commented, doesn’t the dimension that these creatures came from have any other inhabitants, such as fluffy extraterrestrial bunnies or (heavens) plants? And in the spirit of Paul Leggett, who states that “the horror film gives us an insight into the spiritual condition of our culture. This has been true for almost a century. The nature and tone of horror films reveal the outlook and fears of the culture”, one might wonder precisely what the heck the apparent attraction to 70s-esque paranoid horror means about us.

Why are commenters on Amazon and IMDB so hostile to critics, so protective of these works? They certainly appear to be. I plan to analyse the comments at some point to get a feel for how much the actual frequencies of rebuttals in comments vary from other subgenres or occurrences, but qualitatively it looks like it happens a lot. Is this a ‘you love it or hate it’ effect, and if so, what are those who hate this particular subgenre missing? What is the meme hook that provides emotional susceptibility to slasher movies in which everybody dies - for no good reason?

I haven’t been able to get hold of a copy of this paper yet, but Daniel Shaw apparently separated horror into the following genres in ‘Power, Horror, and Ambivalence’: 1, a sort of ‘power-driven’ horror, in which the audience derives pleasure from the sheer power and control of the monster or serial killer, and 2, ‘nihilistic horror’, in which the monster or serial killer seems to be out of control, and therefore powerless. He writes:

‘deeply disturbing and hence not as pleasurable as the bulk of horror films we have been discussing, works of nihilistic horror provide the negative to the positive image of monsters and serial killers that I have been contending comes from their power. Our response to nihilistic horror is different precisely because it denies us the pleasure of identifying with truly powerful (human) protagonists and superhuman antagonists. Like a deer caught in the headlights on a pitch black night, we quiver at the prospect of such an absurd and meaningless fate’

I’m not sure the fate is what gets me. Death by Hollywood cliche is not my worst nightmare. Rather, what concerns me is the idea that for some reason, at least enough people to generate those Amazon comments not only find something extremely attractive in the topic, but are driven to haunt web spaces related to these media in order to defend them in public. To misquote Tori Amos, sometimes I think the national psyche just needs a cup of hot chocolate and a blankie.

May 19, 2008

The mysterious carbon footprint

Category: Blah blah — em @ 01:05

Though I live under a rock and do not have a television, even as a computer geek I was made aware of this recent letter in The Lancet - it made it all the way to Slashdot. For those who are allergic to logging in to sites, it’s been naughtily reprinted in full here.

I understand from comments made elsewhere, such as ABC’s article providing opposing viewpoints that no offense was intended. This is almost certainly the case, and yet a great deal of offense seems to have been caused. It seems that many people have taken the idea that news agencies have extracted from this brief piece of correspondence, ie. that their weight is responsible for the state of the planet, as unnecessarily flippant at best. Who’d ‘a thunk it?

The defense is that these calculations are merely basic physics. Surely nobody should take umbrage at the existence of basic physics. As a sometime physicist, this is where I start to find the story interesting; as every physics student learns, basic physics isn’t. This is seldom a result of incorrect use of a calculator. Rather, it’s because it’s easy to say irrelevant things with equations. Simple back-of-an-envelope calculations often aren’t great models of the real world.

Some things really are fairly easy to model, but lots of stuff isn’t; amongst the latter category are famous examples like kangaroos and bumblebees, both of which have been confounding physicists and engineers for years (kangaroos have a disturbingly efficient means of locomotion, bumblebees likewise in flight). Now the thing that you can say about kangaroos and bumblebees from the perspective of one who wishes to develop a mathematical model is that, at least, all you in principle need to understand the way in which a bumblebee flies is 1) a bumblebee, 2) a lot of patience and ingenuity (and a helium-enriched atmosphere, apparently). The bumblebee flight problem is nice like that, because it really is basic physics. Damn hard, but at least in the end the overall equation is not going to contain anything that you can’t draw on a force diagram.

Is this one of those cases? I have no idea. But calculation of the overall carbon footprint of obese individuals as a class versus that of the rest of the population is in and of itself the sort of problem that I personally would want to think real hard about, because wow, there’s a lot of factors in there that you really can’t draw on a force diagram. That is, an individual’s carbon footprint, as a loose analogue of the negative impact that they have on the environment, isn’t easy to calculate.

The practical difficulty of the carbon footprint has become obvious over the last year or so in the sysadmin world, too; all of a sudden everybody’s asking (increasingly silly) questions about the appropriate method of handling the environmental impact of computing. It has a sad similarity to a bunch of high school students talking about sex. Everybody thinks they know the answer - you won’t get pregnant if you take a shower after, do it standing up, etc…

But it’s quite obvious that the number of people who are really able to speak knowledgeably about the subject - actual environmental cost of manufacturing, usage, cost of retraining, disposal, security impact of alternative approach, etc, is very low. Note: I can’t speak knowledgeably about the environmental impact of processor manufacturing - but know enough to have some inkling as to whether other people are shoveling difficult questions under the carpet. And in this context - the Green Technology world - the bullshit is never far away. I’ve even had it suggested to me that deleting infrequently accessed files from a server’s hard drive will directly reduce its carbon footprint. This is an area in which bizarre speculation seems to flourish.

I respectfully submit that, in practice, back-of-the-envelope calculations belong on the backs of envelopes - and that statements which appear to the naked eye to be flip oversimplifications may in fact be flip oversimplifications. The useful and important point that was made in the letter in the Lancet might be summarised as, “Walking and cycling are good and should be promoted, mmkay? Both people and planet benefit!” Although I might add that trains are also good and should be promoted, seeing as train passengers also commonly walk to and from each endpoint, but I digress… The useless and silly point that was made in the letter in the Lancet was, “BTW: we can do maths with average BMIs that will be widely misreported as the outcome of a peer-reviewed study and will lead to years of vicious bitching from individuals looking for an excuse, in which number incidentally we may as well include the government, who are always happy to have a go at Fatty.”

To those who research this kind of thing: guys, all researchers have a certain level of responsibility. You know, as in Spiderman: “with great power comes great responsibility”? This sort of thing is easier to get away with when you are studying the flight of bumblebees or the energy consumption of kangaroos, for one reason; nobody cares. But you surely were not unaware when composing the letter that the whole I See Myself As Green thing is the self-image issue of the decade. Even I know that, and I haven’t watched British broadcast television for over a decade. If you truly hadn’t guessed that the media would read it as they did, then I am wholeheartedly sorry for you, but this is probably a useful lesson to us all to try not to publish overgeneralisations about - in honour of other famous missteps by other London researchers (cough EP cough) - the capabilities, characteristics or environmental impact of various categories of human beings, unless you are willing for that controversy to become the defining feature of yourself and your work.

I can’t say I look forward to reading more of the same - environmentalist witch-hunts are no better than McCarthyism - but it’s not as though we’re going to have much choice in the matter. So yeah, bring it on. But next time you decide to make a claim that, whether intentionally or not, happens to demonise a decent proportion of the human race according to the hot-button issue du jour, please at least do not do it in the Lancet’s Correspondence, which according to this Nature article does not even appear to be peer-reviewed. Big claims about big people need big proof.

April 1, 2008

Jarre Concert in Birmingham

Category: Music — ArTourter @ 17:41

I know I am hijacking Em’s Blog but we were there together and it was with her phone that I took these shots. Not any good by any stretch of the imagination, but great memories anyway.

Click to continue reading “Jarre Concert in Birmingham”

March 31, 2008

Gaiman on Windows Vista

Category: Opinion — em @ 17:31

From Neil Gaiman’s blog:

Sitting in an airport, getting really sick of Windows Vista on a laptop. It doesn’t work — I’m tired of waiting seconds for things to appear on the screen, of taking half a minute or more for something that ought to happen instantly to occur. The poor computer obviously can’t run Vista, and shouldn’t have been Vista certified, and the author isn’t impressed with the way that a number of things that were easy in XP have got harder, nor with the fact it took most of a day for Vista to run a search on the hard disk to find a mislaid introduction I was working on, nor with its refusal to read or copy a bunch of files on a DVD Dave McKean burned for me (I wound up dragging them from the DVD to one of Dave’s macbooks, from there to my iPod and from my iPod to the computer).
Have any of your readers suggested cures or workarounds for the Vista problem you describe in the 3-27 blog (sluggish text)? If so, please share — many of us have the same problem.
A few people have written in to suggest I get extra memory, and I might, but I’m more likely to either a) say sod it and get an Airbook. It’s heavier than the Panasonic W7 and doesn’t have a disk drive, but it has a nice operating system that works or b) keep the computer and wander over to Linux Ubuntu.
My other solution is to warn the many people who read this blog that they may want to avoid Windows Vista.

Seeing this made me smile, because my lovely new Lenovo tablet came with Windows Vista and, whilst I like the handwriting recognition, there turned out to be really nothing else to recommend the experience. True, I was planning on putting Linux on the thing eventually anyway, but the handwriting recognition was good enough that all other things being equal, I might have at least decided to keep the system dual-bootable. But there were all those other issues, such as DRM that stands on your toes when you least expect it, usually when you’re doing something that is both legal and techie, and yes, the extreme slowness of Windows Vista. Put it on high-performance mode and your battery life drops to nil. Put it on low power consumption and Vista will lose all hint of responsiveness. If you click on something you may as well pop off for a nice cup of tea because you will have the time to boil the kettle before anything happens. And it constantly churns the hard disk. All this on a tablet that is of course not the fastest device currently available, but is Vista certified. I’ve tried various suggestions and had modest success in removing some of the slowness at boot, but it still ties itself in knots regularly enough to be a problem.

I won’t be buying an Air unless I receive valid documented evidence that hell has frozen over. That’s for various reasons to do with battery life (oh, come on, non-user-replaceable battery?), lightness, ruggedness - if that is a word, and I’ m not convinced it is - the absolute necessity of lots of different ports and whatnots in doing all things electronic, and the feel of Lenovo/IBM keyboards. But it does feel better to know that unbiased individuals have given up on Vista too.

March 30, 2008

Note to self: Transferring files to gumstix via serial/rz/kermit

Category: Gumstix — em @ 21:21

This is really simple, but it took a bit of fiddling to work it out. Obviously the bootloader lets one copy files across (that being one means of copying across filesystems and so forth) but I didn’t know how to do this once linux was booted. It turns out to be this simple:

When connected to the serial console/ffuart via ckermit, go to the directory where you want the file. Type:

rz

You will see some bizarre characters appear. Ignore it. Type ctrl-shift-\, or is it ctrl-shift-|, and then ‘?’. Type U to disconnect. Then type:

set protocol zmodem

Then:

send whatever-the-filename-is.ext

Type ‘c’ to reconnect. Hopefully when you then type ‘ls’ you will see the file you just uploaded sitting in the working directory.

The full session will look something like this:

root@gumstix-custom-connex:~$ pwd
/home/root
root@gumstix-custom-connex:~$ rz
rz waiting to receive.**▒B0100000023be50
----------------------------------------------------
Press:
C to return to localhost
? or H for this message
0 (zero) to send the NUL (0) character
B to send a BREAK signal (0.275sec)
L to send a Long BREAK (1.5sec)
U to hangup and close the connection
Q to hangup and quit Kermit
S for status
! to push to local shell
Z to suspend
\ backslash code:
\nnn decimal character code
\Onnn octal character code
\Xhh hexadecimal character code;
terminate with Carriage Return.
Type the escape character again to send the escape character itself,
or press the space-bar to resume the CONNECT session.
Press a key>U
----------------------------------------------------
Hanging up (Back at localhost)
----------------------------------------------------
(/home/em/ckermit/) C-Kermit>set protocol zmodem
(/home/em/ckermit/) C-Kermit>send filename.ext
Sending: filename.ext
Bytes Sent: 7296 BPS:2554
Sending:
Ymodem sectors/kbytes sent: 0/ 0k
Transfer complete
(/home/em/ckermit/) C-Kermit>c
Connecting to /dev/ttyUSB0, speed 115200
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
root@gumstix-custom-connex:~$ ls
filename.ext

Audiostix2, brec and arecord

Category: Gumstix — em @ 21:13

Brec seems to have gone out of fashion since the good old days of buildroot, so I’m assuming it’s all about arecord now.

Users of openembedded can get hold of the package containing arecord by looking through the Packages.gz file (http://www.gumstix.net/feeds/current/glibc/ipk/armv5te/Packages.gz) and pulling out the filename link:


ackage: alsa-utils-aplay
Version: 1.0.14-r1
Depends: libasound2 (>= 1.0.14), libc6 (>= 2.5), libgcc1 (>= 4.1.2)
Section: console/utils
Architecture: armv5te
Maintainer: Angstrom Developers
MD5Sum: c99cfb0f230ce0a963740bb099d32e89
Filename: alsa-utils-aplay_1.0.14-r1_armv5te.ipk
Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.14.tar.bz2 file://alsa-utils-automake.p
atch;patch=1
Description: play (and record) sound files via ALSA

Get the alsa-utils-aplay_1.0.14-etc.ipk, or use bitbake to build it, copy it to your Gumstix, and ipkg install it. Those who have actually set up their Gumstix to access the net directly can of course use ipkg as it is designed to be used, instead of cheating :-P

Once installed, type arecord to record. If one also installs lame, it is possible to do something like this:

arecord -d 5 | lame - test.mp3

to record direct to MP3. Not sure how effective any of this is, as I have not yet found a microphone…! Edit: just remembered that earphones make lousy but effective enough microphones. It works, except that the default record mode for arecord causes nasty, choppy sound. This is better:

arecord -d 5 -f cd test.wav

However this produces too much data to sanely encode it realtime into mp3. Something like: arecord -c 1 -d 5 -f S16_LE -r 22050 test.wav produces a slightly more managable filesize, but even so you’re probably better off producing the wav and then mp3ing it at some quiet moment.

March 25, 2008

I2C on the Gumstix/Robostix

Category: Gumstix, Hackery — em @ 02:30

…really is as simple as they say it is. I know, it shouldn’t come as much of a shock but I guess all that buildroot fun in ages past has caused me to expect complexity where there is none.

I started with the Dallas 1307 RTC from Sparkfun — but as an aside, you can get them from Tinker.it in the UK now, which I hilariously noticed almost five minutes after opening a letter from customs reclaiming a load of tax that FedEx kindly paid at the border. As a further aside, UPS ought to take lessons from the way FedEx handle import charges. When I order Gumstix, the UPS guys just turn up at the door demanding cash on delivery, which is just plain uncouth since it means I can’t get them to deliver at the university front desk unless they’ve already failed delivery once, at which point they generally leave something saying what I owe them so that I can phone them up and pay it by credit card, the fiends. And they charge a higher fee. The fiends. Anyway, as Wooster would say, back to the res.

The classic example I2C device given on the wiki is in fact this very same device, so there is no reason to have expected any complications.

And there weren’t any. Connect the robostix to the RTC module as follows:

Robostix UARTS:

pin 16 (I2C SCL) -> SCL
pin 15 (GND) -> GND
pin 14 (+5V) -> 5V
pin 12 (I2C SDA) -> SDA

Let’s try it:

root@gumstix-custom-basix:~$ i2c –count=8 0×68 readbyte 0
0×0955000325030800
What this means:

Receive 8 bytes from the I2C bus at address 0×68

Read in this order: Second, minute, hour, weekday, day, month, year, control byte. Hence, I tested this on the 25-03-08 (a Tuesday) at 00:55:09 in the morning. Now, the problem that one is probably trying to solve by connecting an RTC at all is setting the system date, which you do manually like this:

root@gumstix-custom-basix:~$ date -s 032501092008
Tue Mar 25 01:09:00 UTC 2008
The order: Month, day, hour, minute, century and year.

The following script is a fugly five-minute hack, and if you have any time to spare you will do it properly and get a kernel that is able to read this clock directly. If you are instead in need of a fugly five-minute hack:

#!/bin/sh

#get value from RTC
datetime=`i2c –count=8 0×68 readbyte 0`

second=`echo $datetime| awk ‘{split ($0, a, “”); print a[3] a[4]}’`
minute=`echo $datetime| awk ‘{split ($0, a, “”); print a[5] a[6]}’`
hour=`echo $datetime| awk ‘{split ($0, a, “”); print a[7] a[8]}’`
day=`echo $datetime| awk ‘{split ($0, a, “”); print a[11] a[12] }’`
month=`echo $datetime| awk ‘{split ($0, a, “”); print a[13] a[14] }’`
shortyear=`echo $datetime| awk ‘{split ($0, a, “”); print a[15] a[16] }’`
year=”20$shortyear”

echo “RTC: $hour:$minute:$second $day-$month-$year”

# example of date format: date -s 032501092008
# Set date:
datearg=$month$day$hour$minute$year;
date -s $datearg

March 22, 2008

Robostix and OpenEmbedded: talking to the Gumstix

Category: Gumstix — em @ 00:13

If you are using OpenEmbedded instead of buildroot to build your gumstix’s software, then some of the documentation will look a touch outdated. The following is not necessarily guaranteed to be globally true, but works for me. The robostix modules and whatnot are in

Your Home Dir /gumstix/gumstix-oe/tmp/work/gumstix-custom-connex- angstrom-linux-gnueabi/robostix-module-1.0[whatever]/install/robostix- module/

Place them on your Gumstix in the indicated subdirectory. Don’t forget to edit /lib/modules/2.6.21/modules.dep and add the robostix.ko filename and path to it, since otherwise modprobe will not see it.

modprobe robostix to load it.

You will also be wanting the robostix command line program, that appears in your buildroot under

Home Dir/gumstix/gumstix-oe/tmp/work/armv5te-angstrom- linux-gnueabi/robostix-cmdline-1.0-r1/install/robostix- cmdline/usr/bin/robostix

The robostix is initially held in ‘reset’ mode by the gumstix. This is not a problem that needs to be fixed in hardware - it’s one of those things that you can fix by manipulating ‘GPIOs’, which incidentally are general-purpose input-output lines, which is to say, i/o wires. To turn it on, once you have installed these programs onto your gumstix, type:

robostix reset off
and Bob is your metaphorical uncle.

Alternatively take a look at the settings in the robostix /etc/init.d/robostix file:

echo “Starting robostix…”

# Make sure ttyS2 is setup
echo “AF2 in” > /proc/gpio/GPIO46
echo “AF1 out” > /proc/gpio/GPIO47

# Turn on the robostix ‘245
echo “GPIO out clear” > /proc/gpio/GPIO72

# Turn on the robostix Power
echo “GPIO out set” > /proc/gpio/GPIO70

# load driver
/sbin/modprobe robostix

# Take the robostix out of reset
echo “GPIO out set” > /proc/gpio/GPIO73
That is, basically, tell the gumstix to stop resetting the robostix and let it do its own thing.

Whatever program was installed on your robostix (say, LED flashing) should suddenly start functioning at this point. To stop it again, robostix reset on (it’s even intuitive).

To get all this to autostart symlink /etc/init.d/robostix to something like /etc/rcS.d/S97robostix

Or better still, read http://docwiki.gumstix.org/Robostix_gumstix_ISP#Installing_Driver_and_Command_Line_Tool_Permanently on the gumstix wiki

If some or all of these files don’t seem to be present in your OpenEmbedded folder that is probably because your configuration doesn’t include them. Check out .gumstix/gumstix-oe/com.gumstix.collection/conf/machine/gumstix-custom-connex.conf
assuming that is you have a connex.

The operative part is:

# if you enable robostix you will need to disable both “lcd” and “touchscreen” features
MACHINE_FEATURES += “robostix”

#MACHINE_FEATURES += “lcd”
#MACHINE_FEATURES += “touchscreen”

(If you’re using a standard openembedded binary you will have to remove these modules - anything that looks like it’s about touch screen and lcd).

Now assuming that part of the point of all of this was to have the robostix speak to the gumstix, you’ll need a few things. First, you’ll need the right jumpers, as shown here: http://docwiki.gumstix.org/Robostix_gumstix_ISP. That is, Atmel 0 Tx to PXA ST Rx and Atmel 0 Rx to PXA ST Tx. Which is to say, connecting the business ends of the AVR’s UART (ttl-level serial) to the business end of the gumstix’s UART.
Second, you’ll need to install a test such as the flash_led program, flash-led.c that writes to the UART on the robostix. Do this by flashing the AVR via the ten-pin ISP socket. REMEMBER TO REMOVE THE GUMSTIX FIRST. Then, do this:

#!/bin/sh
echo “AF2 in” > /proc/gpio/GPIO46
echo “AF1 out” > /proc/gpio/GPIO47

Set the speed to 38400, because otherwise you get the textual equivalent of technicolour gibberish:

stty 38400 < /dev/ttyS2

and

cat /dev/ttyS2

You should see:

Read: ‘ ‘
*** Press a key to continue
*** Continuing…
etc.
Or try: echo “zzzzzzzzzzzzzz”> /dev/ttyS2; more /dev/ttyS2

…which returns

‘Read: ‘z’
Read: ‘z’
Read: ‘z’
…’

Congratulations. You are now talking to your AVR. The dialogue may not be much, but hey :-)

March 21, 2008

Viewing Gumstix output (FFUART) via the robostix

Category: Gumstix — em @ 22:50

This is another one of those memo to self posts. Sorry, but if I fail to write down things like pinouts then I am doomed to have to trawl back through the Gumstix wiki the very next time it seems like a good idea.

In short, I got one of these handy FTDI TTL to USB (serial) cables, with a six-pin female header.

  • Pin 1 of the robostix header (GND) goes to pin 1 of the TTL header (black cable: GND),
  • pin 2 of the robostix header (TXD) to pin 5 of the TTL header (orange cable: RXD),
  • and pin 4 of the robostix header (RXD) to pin 4 of the TTL header (yellow cable: TXD).

I did NOT plug in pin 3 of the robostix header to pin 3 of the TTL header, because pin 3 of the TTL header is a VCC supply.Robostix pinout:

1 - GND
2 - TXD
3 - VCC
4 - RXD

smallimage.jpg

Screenshot:
smallimage2.jpg

Edit to add: the FTDI cable is recognised on Linux as a USB serial port (/dev/ttyUSBn). To view the FFUART (Gumstix console) output and to write to it, connect to the relevant port using ckermit. This doesn’t come as default, at least on Slackware 12; just download and compile it from here.

It is possible to automate the process of configuring ckermit with a script like this one (which I think I got from the Gumstix wiki):

#!./ckermit +
kermit -l /dev/ttyUSB0
set speed 115200
set reliable
fast
set carrier-watch off
set flow-control none
set prefixing all
set file type bin
set rec pack 4096
set send pack 4096
set window 5
connect

A minor advantage of this approach, incidentally: because Vcc is not required, the boot prompt appears without any need to mess around with patch wires and things - which the Gumstix wiki suggests is necessary to use a TTL converter that is powered from the robostix’s Vcc…

March 20, 2008

NKC Serial Freeduino board issues…

Category: Hackery — em @ 04:28

I bought one of these because of the serial interface. The logic: I want to talk to gumstix; gumstix like RS232 but aren’t so uniformly convinced about USB host. There are several options, of which I tried three this week: AVR plus TTL-RS232 conversion, i2c between robostix and gumstix, RS232-speaking Freeduino.

Anyway, to the point: these Freeduino boards seem to have occasional problems. This particular kit doesn’t seem to auto-reset successfully and also seems capable of confusing itself in the attempt, though aside from that it does work. Installing the Adaboot bootloader directly via an AVR ISP programmer has partly fixed this issue for me. If I press down reset for a good long time and then tell the Arduino software to upload a sketch while simultaneously letting go of the button, standing on one foot and humming the chorus of ‘Waltzing Matilda’, it generally does successfully write the sketch. Auto-reset just plain won’t behave, but if it is manually reset, run at 19200 and treated as an Arduino NG in the Arduino software (version 0010 here), it currently seems to behave more or less as expected. However, programming fails so often and is so touchy that you would always want to have an in system programmer ready at hand to rewrite the bootloader when, for whatever reason, it all breaks. The thing is that there are many possible reasons for these issues. Maybe my usb to serial conversion cable is a bit touchy. Maybe one of the components is a touch on the dodgy side. Maybe it’s user error…
But if you don’t have a great reason to go for a serial board right now but do need serial, you might want to wait for something like the version described in this thread; a Freeduino with Max232 or equivalent. Wikibooks has a great explanation of what all this means. This particular Freeduino uses a couple of transistors to get the same sort of effect. If there is no pressing need to use serial, USB Arduinos seem to work like a charm. Or an AVR on a lump of veroboard with an oscillator, a couple of capacitors, a few resistors on appropriate pins, an ISP header, a voltage regulator and a TTL converter - a.k.a. a homebuilt Arduino :-)