Archive for the ‘Uncategorized’ Category

More Sinatra from the Ubuntu Folk.

I remember when the kids decided that they wanted to adapt the unnecessarily complicated system V init system and I kissed the simple days goodbye (sometimes I miss early bsd/freebsd and sometimes i miss it alot). Nowadays even the sysv-init isnt complicated enough. We gotta have upstart.

So after upgrading two systems to Lucid, I can tell you that most of the details have been well paid attention to, and a few problems we were having with 9.10 and hardy actually got solved. But there is still stuff that wasn’t broken that the kids just had to fix. So without further adeau I will tell you how to get gdm (and X) to go away after you have installed sysv-rc configured it to runlevel 3 (multiuser - no x) and its still there.

Setting the runtime.

If you have a working inittab the existing scripts will reference it so you can skip to how to get rid of gdm.

if you don’t you will find that the default runlevel is set to 2 (linux’s ‘user defined’ graphical runlevel since rc5 wasnt good enough for some reason) in /etc/init/rc-sysinit.conf. This should be changed to look like this.

# Default runlevel, this may be overriden on the kernel command-line
# or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=3

rebooting and typing “runlevel” should verify the change.

Why is gdm/X still running?

Beats the begebes out of me. But if you want it to stop you need to edit the /etc/init/gdm.conf and comment out the “start on” conditions and change them so that they correspond to the appropriate runlevel.

#start on (filesystem
#          and started dbus
#          and (graphics-device-added fb0 PRIMARY_DEVICE_FOR_DISPLAY=1
#               or drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
#               or stopped udevtrigger))
start on runlevel [24]
stop on runlevel [0136]

Grubby.

If you don’t want gdm/x you probably don’t want the splash junk either. While /boot/grub/menu.lst allows you to set default options like nosplash every kernel upgrade i have done in the past year explicitly asks for quiet and splash way out at the end of each “kernel” line so just plan on hand editing the darned thing after each kernel update. I am sure you can uninstall splash but I prefer configuring things to keeping track of what needs to be uninstalled for a system to run correctly.

Damned Kids.

Hope this saves you some of your precious hair. All and all lucid (server and desktop) seems pretty sane and stable but they are still fixing things whether or not they were broken.

Dont even get me started on last weeks apparmor configuration update busting our dns.

Tracing Multiscale Mechanisms of Drug Disposition in Normal and Diseased Livers

Our second ISL tracing paper has been published online as a JPET FastForward Article Tracing Multiscale Mechanisms of Drug Disposition in Normal and Diseased Livers.

I’ll repeat the brief blurb on my agent based modeling website.

This paper talks in relative detail about how hypothesis formulation and falsification (failed validation) can be done at a fine grain when only coarse grained validation data is available. Because our in silico liver (ISL) is an analog built in software, we can trace its internals. And because the internals of the analog were designed to map to the internal structure and dynamics of its referent (wet-lab liver perfusion experiments), traces of the ISL become detailed hypotheses about the internals of the liver. However, those detailed hypotheses are not falsifiable, except to the extent that they fail to reproduce the coarse validation data. Nothing can be done about that until we design wet-lab experiments to perform on real livers. In the meantime, though, we can alter the ISL mechanisms so that the coarse grained data matches that taken from wet-lab experiments under different conditions. In this case, we build 3 ISLs that generate the outflow profiles for drug and a sucrose marker for: 1) normal healthy livers, 2) alcohol damaged livers, and 3) carbon tetrachloride damaged livers. With the traces for each of the 3 ISLs, based upon the validated (i.e. not proven true, of course, but proven true enough) mechanisms of the ISL, we can formulate ‘proto-theories’ for the translation of an experimental liver from a healthy to a diseased (cirrhotic) state.

Note that the particulars of the ‘proto-theories’ suggested by these traces are not as sophisticated as those that might be generated by an expert hepatologist. In fact, these ‘proto-theories’ may even seem bizarre or patently false to such an expert (though I believe they don’t seem so to the experts). Indeed, as Box’s aphorism says,

… all models are wrong; the practical question is how wrong do they have to be to not be useful.

The point is not to build computer programs that attempt to compete with the hypothesis formulation of experts. This is not an AI project. The point is to build devices, with whatever tools are available including computers, that make the experts more efficient and effective. By formulating these ‘proto-theories’ about the translation of healthy livers to diseased livers (and vice versa), models like the ISLs provide a foil or sounding board to help sharpen the theories developed by the experts.

In Silico Liver port to MASON

I set this task aside awhile back. When I returned to it, we had moved the source repository to a different machine. I had lots of changes in my local sandbox. Several of the prerequisite libraries had been upgraded. Etc. After doing all the catch-up work and checking it in, however, it compiled and ran right out of the box! I’m always surprised when that sort of thing happens.

Way early ISL in MASON mock-up.

Windows Vista using a CUPS PDF printer hosted on Debian

So, every time I upgrade my system, it seems like my printers break.  I don’t know if it’s bad management of the cups debian packages, the peculiarity of windows, or my own incompetence.  The breaks have wildly varying symptoms.  So, I haven’t seen a pattern in them that allows me to fix things gracefully.  Sometimes Samba is to blame.  Sometimes CUPS (-PDF) is to blame.  And sometimes Windows is to blame.  Well, when I upgraded from Lenny to Squeeze awhile back, of course it broke my virtual PDF printer that I use to generate electronic invoices.  When I’d try to connect to the printer (as configured in Lenny), I got the following error:

Windows cannot connect to the printer. Operation
could not be completed (error 0×0000000d).

(No, it wasn’t in those colors or with that background… but I figured I’d try to find a way to make you, dear reader, feel as annoyed as I felt when I saw the error.) Anyway, with such a wonderfully informative error, I didn’t know quite where to turn. The logs (cups, samba, auth.log, syslog, etc.) on the server gave no indication that anyone had tried to connect. And I could browse the other shares from the vista machine nicely and those connections did show up in the logs. So, I had a strong indicator that the problem was NOT my upgrade from Lenny to Squeeze. But, being the stubborn idiot that I am, I started fiddling around with the printer and samba configs anyway…. which lead nowhere, of course. The upside is that I am just a smidgeon more familiar with cups and samba. [sigh]

When I finally typed the error into a search engine, I found the answer provided by some participants of Microsoft TechNet, which I repeat here for posterity:

From: AHarsent

I've seen this problem with a few printers now, not
consistantly[sic] between any particular makes or
models. However, I have found a consistant[sic]
fix to connect to any network printer from vista:

Run a command prompt and type the following:

   net use LPT2: \\servername\printer

This sets up a behind-the-scenes connection to
the printer.

Then go through the add printer wizard, choose to
add a local printer, and choose port LPT2… It will
probably ask for a printer driver, and you can just
choose whatever XP driver you might have been using
before. The printer is then installed without any errors,
and works just fine.

Of course, since I’m using CUPS-PDF, I don’t have a printer driver. I just use the Generic MS Publisher Imagesetter, which seems to work nicely. And now that I’ve made the right sacrifices to the right gods, I’m back to being able to generate PDFs from any program on the windows machine.

Dual coordinate plots in R

The default plot functions in R don’t seem to facilitate plotting two dependent variables using different scales on the same plot, against the same independent axis. But it’s not that difficult, as I learned from: Jim Lemon’s “Kickstarting R”. But even his example isn’t simple enough for me. So, I generated this:

par(mar=c(5,4,4,4))
plot(1:11, 1:11, ylab="", col="green", axes=F)
axis(1,1:11)
axis(2,1:11, col="green")
par(new=T)
plot(1:11, 5:-5, ylab="", axes=FALSE, pch=3, col="blue")
axis(4, -5:5, col="blue")
par(new=F)

which produces this:

p4_error: Could not gethostbyname for host

For awhile now, we’ve been unable to run using the “-nolocal” flag to the mpirun command in order to execute our simulation across the slave nodes without also treating the master as a slave. When I would run with:

$ mpirun -nolocal -np 7 ./simulation 

I would see an error like the following:

p0_10460: p4_error: Could not gethostbyname for host hostname; may be. invalid name

Being lazy, I spent quite a bit of time trawling the intertubes looking for a canned solution and found many dead-ends talking about the resolver, nsswitch.com, etc/hosts, etc. So, I finally sighed and reluctantly pulled out my programming hat and wrote the following:

#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
int main(int argc, char *argv[])
{
  char *user_host = calloc(32, sizeof(char));
  int error = gethostname(user_host,32);
  if (error != 0) {
    printf(”gethostname failed with error %d\n”, error);
    return error;
  } else
    printf(”user_host = %s\n”, user_host);

  struct addrinfo *res0, hint;
  memset(&hint, 0, sizeof(hint));
  hint.ai_family = PF_UNSPEC;
  hint.ai_flags = AI_CANONNAME;
  error = getaddrinfo(user_host, NULL, &hint, &res0);
  if (error != 0) {
    printf(”getaddrinfo failed with error %d.\n”, error);
  }

  struct hostent *he;
  he = gethostbyname(user_host);
  if (!he)
    printf(”gethostbyname(gethostname()) failed\n”);
  else
    printf(”gethostbyname(gethostname()) = %s\n”, he->h_name);

  free(user_host);
  user_host = “hostname”;
  he = gethostbyname(user_host);
  if (!he)
    printf(”hostname(/*hardcoded*/ \”hostname\”) failed\n”);
  else
    printf(”hostname(/*hardcoded*/ \”hostname\”) = %s\n”, he->h_name);
  return 0;
}

And that showed me that the string returned by gethostname() was flawed in some way… some insidiously evil and occult way that doesn’t show up on the terminal screen. Redirecting the output to a file and editing that file with vi showed me that there was a SPACE on the end of the string returned by gethostname(). Ugh.

Other symptoms you might see if you have cruft in your /etc/hostname entry:

sudo: unable to resolve host
hostname => hostname
hostname -f => Unknown host
hostname -a => Unknown host

Virtualizing the UCSF Cluster.

The computing cluster we maintain at uscf is built on a stock ubuntu hardy (desktop) with software added to it either to match the previous configuration or as needed by the experiments which are being conducted on the system. This decision was made as a compromise between the user community which was familiar with Ubuntu and the need for a stable (LTS) platform from an administration perspective. Since the hardware on the cluster is aging and reinstallation of systems requiring on site administration is expensive. We are evaluating alternatives such as the Amazon Elastic Cloud. This is an overview of an attempt to create a virtual instance of the servers used in the cluster. (The process is actually done twice since the head node is built on intrepid (desktop) because the processor configuration was not compatible with hardy’s install kernel.)

Out of hundreds of prebuilt images avaliable for the “Elastic Cloud” there are two sets of ec2 AMIs that closely match the platform that we are running. One is from alestic http://alestic.com/2009/04/official-ubuntu-ec2 and the other is a relatively new bundle from Ubuntu http://www.ubuntu.com/products/whatisubuntu/serveredition/features/ec2.

My initial attempt to create a package used the alestic desktop image. On top of taking more than 7 hours to merge the packages installed on the reference platform the result was completely unusable. Some of this was due to my not catching packages which did not work on ec2 such as grub and the kernel which was installed on the reference platform. Unlike VMware’s virtualization the amazon cloud is pretty particular about a few things. For this reason I found it prudent to start with systems which were native to the cloud and modify them.

The Ubuntu AMI advertises itself as “server” which is bare bones to the point of uselessness. Comparing the installed packages on the reference platform to the server left over 500 packages to sort through.
Fortunately the instantiated version allows you to install a set of packages which includes the desktop. This left us a delta of around 100 packages. Eliminating the packages that were not likely to work on the EC2 such as the standard kernel and grub resulted in less than 90 new packages to install.

Once I set up the ec2 tools and environment in accordance with amazons documentation http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/. I created an instance of the Ubuntu AMI (ami-5d59be34)

$ ec2-run-instances ami-5d59be34 -k n01-keypair
$ ec2-describe-instance (...wait until its running)
$ ssh -i id_rsa-furm-keypair ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com

With the basic instance installed you can  “sudo tasksel” and select Ubuntu desktop (in addition to the ssh server and any other appropriate packages). Once it completes the installation you can get a list of the installed packages and compare it to the packages on the reference platform and using aptitude install the additional packages. I use aptitude since it handles dependencies more ‘apt’ly than apt-get.

# dpkg --get-selections|grep install|cut -f1>ubuntu-intrepid-ec2.packages
# exit
$ exit
$ scp -i ~/.ssh/id_rsa-n01-keypair ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com:ubuntu-intrepid-ec2.packages .
$ dpkg --get-selections|grep install |cut -f1 >reference.package
$ diff ubuntu-intrepid-ec2.packages reference.packages |grep \>|sed 's/> //'>packages2add
$ nano packages2add <<<<<< delete linux* grub and any kernel packages.>>>>>>>
$ cp -i ~/.ssh/id_rsa-n01-keypair packages2add  ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com:.
$ ssh -i ~/.ssh/id_rsa-n01-keypair ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com
$ sudo bash
# for p in `cat packages2add` ; do echo $p;  aptitude -y install $p; done

At this point you should back check the new manifest and reboot the instance to make sure that you didn’t break anything before using your modified instance to create a new bundle. The ubuntu AMIs come with two disks defined by default / and /mnt which are close to the same size. you use /mnt to create an image. The process is convoluted at best. There is a pretty good description at http://alestic.com/2009/06/ec2-ami-bundle.

$ scp -i ~/.ssh/id_rsa-n01-keypair  *.pem ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com:.
cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem     100%  916     0.9KB/s   00:00
pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem       100%  922     0.9KB/s   00:00
$ ssh -i ~/.ssh/id_rsa-n01-keypair ubuntu@ec2-75-101-175-209.compute-1.amazonaws.com
$ sudo bash
# ec2-bundle-vol -r i386 -d/mnt -p ucsf-hardy-node \
-u XXXX-XXXX-XXXXX \
-k /home/ubuntu/pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem \
-c /home/ubuntu/cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem \
-s 10240 -e /mnt,/tmp,/root/.ssh,/home/ubuntu/.ssh
Copying / into the image file /mnt/ucsf-intrepid-head-node...
... <<<<<<< wait for a small eternity >>>>>>>
Bundling image file
... <<<<<<< wait for a nother small eternity >>>>>>>
Creating bundle manifest...
ec2-bundle-vol complete..
#ec2-upload-bundle  -b ucsfintrepid -m /mnt/ucsf-intrepid-head-node.manifest.xml   \
-a XXXXXXXXXXXXXXXX  -s XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Creating bucket...
Uploading bundled image parts to the S3 bucket ucsfintrepid ...
Uploaded ucsf-intrepid-head-node.part.000
...
Uploaded ucsf-intrepid-head-node.part.167
Uploading manifest ...
Uploaded manifest.
Bundle upload completed.

Once this is done you have to register the bundle this is done from the local machine (reference).here.

$ ec2-register ucsfintrepid/ucsf-intrepid-head-node.manifest.xml
IMAGE    ami-f339d89a

Then you can test load it.

$ ec2-run-instances ami-f339d89a -k n01-keypair
$ ec2-describe-instances
...INSTANCE    i-af261cc6    ami-f339d89a    ec2-67-202-25-96.compute-1.amazonaws.com    domU-12-31-39-00-65-C8.compute-1.internal    running    n01-keypair    0        m1.small    2009-07-20T03:41:11+0000    us-east-1c    aki-714daa18    ari-6a5bbc03        monitoring-disabled
$ ssh -i ~/.ssh/id_rsa-n01-keypair  ubuntu@ec2-67-202-25-96.compute-1.amazonaws.com

If this is successfull you can terminate your original instances.

$ for i in `ec2-describe-instances |grep INSTANCE |cut -f2` ; do ec2-terminate-instances $i; done
INSTANCE    i-cd4f75a4    running    shutting-down
INSTANCE    i-af261cc6    running    shutting-down.

(This is important since amazon charges a nominal amount for each instance’s runtime ).

Converting Android 1.5 “Camcorder” videos with SAMR audio codec on Ubuntu Jaunty with ffmpeg

So, T-Mobile pushed the Android 1.5 update to me last Sunday (I think).  I installed it and subsequently had to record a video with the new Camcorder application.  It works well; but produces videos with the audio track in AMR format.  The standard ffmpeg distributed with Ubuntu doesn’t have AMR compiled in because the AMR codec isn’t liberated/free.  I followed Chez’ instructions with a few modifications to get a tweaked ffmpeg that will convert videos recorded with my G1 phone.

  • Run the standard ffmpeg to get the configure options used to compile it.
  • apt-get install libmp3lame-dev libgsm1-dev libshroedinger-dev libspeex-dev libtheora-dev libvorbis-dev libdc1395-22-dev.
  • Download, unpack, configure [--prefix=/usr/local/amr], make && make install both libamr-nb and -wb.
  • svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg-2009-06-02.
  • configure [*], make && make install ffmpeg.
  • export LD_LIBRARY_PATH=/usr/local/amr/lib:/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH
  • /usr/local/ffmpeg/bin/ffmpeg -i video.3gp -ar 44100 vide.mpg

[*] I ended up using the following configure command for ffmpeg:
./configure –enable-gpl –enable-postproc –enable-x11grab –prefix=/usr/local/ffmpeg –enable-avfilter –enable-avfilter-lavf –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –disable-stripping –enable-libdc1394 –disable-armv5te –disable-armv6 –disable-armv6t2 –disable-armvfp –disable-neon –disable-altivec –disable-vis –enable-shared –disable-static –enable-libamr-nb –enable-libamr-wb –enable-nonfree –extra-cflags=-I/usr/local/amr/include –extra-ldflags=-L/usr/local/amr/lib

Reinventing the Wheel (watcher)

Its not very often that you get to go back to old designs and make improvements. Recently I got to rework a design from last year and build on the collective knowlege of 2 design teams and 3 design cycles.

Does practice make perfect? We shall see.

The first run.

Last year I got to build the electronics for a stationary bike racing system. The system had a large ballfield style clock with four hands that were run by these monster stepper motors The initial design was for two bikes done by Percor: a company that makes excercize equipment. Their design used these industrial (expensive and very bulky) cherry hall effect sensors which they loaned us for a race at Lance Armstrong’s bike shop in Austin (http://www.mellowjohnnys.com/). My job for that cycle was to replace Percor’s pic based board with a 4 bike setup.

I broke the stepper driver section into four individual boards. For the processor I built a custom mega128 based board and did the programming in wiring.

Second iteration.

When the Austin race was over Percor needed their parts back so I got to rebuild the sensors. I found some allegra hall effect sensors which were a small fraction of the cost of the cherry’s (like (75c<$25.00)X4). As an attempt to get a zero indicator on the clock I experimented with a triangle based design

While I never did get this particular part of the clock to work correctly the triange stuck as a shape that I liked working with.

I also wanted to replace the cat5 wire used in the Percor design with with less expensive phone cord. (I got a panicked phone call  from Texas and had to remotely direct someone how to get some very expensive ethernet cable on a weekend: it was not cool). To do this I put a non inverting buffer on the sensors and since buffers come in 6s I put an indicator led on the sensors output. In the practice of setting this up for the next race, the blinking lights were invaluable.

Third Time Charm.

A few weeks ago I was asked about another race setup in SanFrancisco. They were going to use a system called open sprints for the display but the open sprints people were out of their hardware for the sensors. So I got a 3 week timeline to put together a sensor and hardware interface that would be compatible with open sprints.

Open sprints (www.opensprints.org) is an open source ruby based software which takes information from an arduino and presents the race data in a way that can be projected instead of having a physical race clock. The only thing that needed to be built was the input side.

So I went back to what I liked and didn’t like about my earlier design and compared and contrasted the opensprints, the percor and my designs to come up with a new system which I could then have fabbed by our local pcb fab (sunstone.com). Looking at the opensprints design I revisited the hall effect sensors and found a set of sensors to experiment with and began to lay out my boards.

I had intended to use the dart design with a through hole led and a throuch hole (sip) sensor and then have some laser cut transparent plastic which could then be “lit” up by the led on the board. A second piece of opaque plastic would be cut to insulate the bottom of the board.

After talking to some of my ee freinds I decided to replace the on board drivers with a single schmidt trigger on the other end of the sensor cable (the percor design used these as well) When selecting the parts I found myself looking at a few options for the rj11 connectors. I ordered a few of each as well as both sip and the origional smt sensor from last year.

Who needs plastic?

When I got the parts I started looking at these rj11 connectors and rethinking things. The connectors were surface mount and shielded. The shielding wasn’t needed but they matched the un-soldermasked boards in texture in color they were about 7 cents more expensive apiece but they looked futuristic.

I went back to surface mount only. If I got rid of the sips and used the surface mount rj11 mounts then the bottom of the board would be shield/ground no insulation needed. The metal from the surface of the board and cable connector would reflect the light from the led and if any attention were payed to the layout of the traces it would look cool!

Even in the hand rolled prototype!

Who needs an Arduino?

At this point given Paul Stoffregon’s (pjrc.com) “teensyduino” software and his 90usb based boards there is no reason to buy any other arduino or arduino clone. ( at least in cases where you need usb to serial solution — in cases where usb-serial is not needed the dorkboard rules :) My first thought was to do a carrier board for on of Paul’s boards and adapt the opensprints code for the inverted inputs. The opensprints code needs to be adapted to invert the input signal and to adjust the registers for the different processor but using the teensyquino codebase that should be simple enough.
In this application however, the board was so simple that it made more sense to just adopt the eagle design for my at90usb162 board (the benito).

Tomorrow I get the boards from sunstone and I should have the hardware built out by late friday. The customer will be in portland saturday.

Does practice make perfect? We will let you know by next week.

Matlab C API, engdemo.c, and JMatLink “Can’t start MATLAB engine.”

OK.  Since I stupidly spent too much time on this problem, I feel like I have to write about it here in the hopes that I can decrease the stupidity in the world.

I’ve written a GUI for a Matlab simulation.  On Linux, we use the JMatLink bridge between Java and Matlab.  At some point, when doing a dist-upgrade on my Ubuntu laptop, the JMatLink bridge stopped working, yielding the uninformative error:

Can't start MATLAB engine.

Well, I proceeded to hack JMatLink, turn on debugging for it, futzing with my LD_LIBRARY_PATH, and my PATH, changing JDKs (since there is a problem with the Sun JDKs and the X11 library libxcb (see here and here for more info on that — I finally downgraded to the gutsy libx11-6 and libx11-dev), etc.

In any case, my fog finally lifted and I decided to try the engdemo.c file provided by Mathworks as the canonical demonstration of calling Matlab from C. And, sure enough, I get the same uninformative error: Can’t start MATLAB engine.” So, I Ask.com’ed (no I don’t usually use the Eye of Sauron for searching) for URLs with this text in them and found: this post by “Mohammed Hasan”. Sure enough, I did an:

$ sudo apt-get install csh

and all is now well. [sigh]

Lost passwords on Mac OS X

So, I inherited TDI’s MacBook from Cosmo who acquired a new one. He was nice enough to set up my user account with no password. Well, of course, that was untenable. So, I immediately set my password. … Time passed because I was occupied with other things. And, of course, I forgot the password. (As usual, this episode allowed the Mac vs. PC argument to bubble to the surface again. I rejoice in such arguments because diversity is the key to agility and dissent is the primary marker for diversity.)

Most websites claim you need an OS X install CD to reset the password. But, the helpful “Dr. Michael” showed us the unix way to do it, with which I’m so much more comfortable. In case that post disappears, here is a modified version of what he said that worked for me:

  1. boot into single user mode (holding command s)
  2. execute the two recommended commands

    /sbin/fsck -fy <return>

    and

    /sbin/mount -wu / <return>
  3. type

    passwd <username>
  4. type the new password <return>
  5. confirm the new password <return>
  6. restart with

    reboot <return>

Cellular Automata Video Synthesizer

Finished assembling my CAVS from Critter and Guitari.

Here it is in action:
CA Video Synthesizer in action

It’s more difficult than I expected to find a stable, interesting CA. But, although at first annoying, the audio helps find stable and interesting CAs.

http://agent-based-modeling.com

Since TDI is such a wide ranging beast, we’ve created a more targeted website for the agent-based modeling work TDI does.  Check it out.

Almost ready to work

I’m almost ready to work here in our new “office”!

1228866215328
1228866199630
1228866175307
1228866155459

Testing the Atmel Mega32U4

Mega 32 U4

While I am wrangling with the appropriate board design, I needed to get started working with the underlying software so I ran up one of the six samples I was able to get from Cascade on a tqfp adapter from measure explorer.

Schematic For Test Board

The AtMega32U4 http://www.atmel.com/dyn/products/product_card.asp?part_id=4317 is the midrange model in the atmel usb chipset. It follows a new standard naming convention that atmel is adapting U for Usb 4 is for the 40 pins 32k, there is another 32K part the U6 which has the same pinouts as the 90usb646/647/1286/1287. The U4 does not have a legacy pinout however the q1000 price for this board is around $2 which makes it a very powerful chip for the money.

Dfu-Programmer.

There is a recent release of dfu-programmer (0.4.6) but it seems that they havent read the atmel doc on the signatures for the dfu recently. http://www.atmel.com/dyn/resources/prod_documents/doc7618.pdf recently.

I need to check the memory and eeprom sizes against the datasheets for the parts. However the table in arguments.c should have the following entries; added new parts, corrected 64x and 82 signatures. (I will resubmit this patch).

/* ----- target specific structures ----------------------------------------- */
/*  { "name",         value,            ,device_type, chipID,VID   , MemSize,FPSize,abt,ifclass,eepgsz,eepmemsz} */
static struct target_mapping_structure target_map[] = {
    { “at89c51snd1c”, tar_at89c51snd1c, device_8051, 0×2FFF, 0×03eb, 0×10000, 128, false, true,  0,   0      },
    { “at89c5130″,    tar_at89c5130,    device_8051, 0×2FFD, 0×03eb, 0×04000, 128, false, true,  128, 0×03FF },
    { “at89c5131″,    tar_at89c5131,    device_8051, 0×2FFD, 0×03eb, 0×08000, 128, false, true,  128, 0×03FF },
    { “at89c5132″,    tar_at89c5132,    device_8051, 0×2FFF, 0×03eb, 0×10000, 128, false, true,  0,   0      },
    { “at90usb1287″,  tar_at90usb1287,  device_AVR,  0×2FFB, 0×03eb, 0×1F000, 128, true,  false, 128, 0×0FFF },
    { “at90usb1286″,  tar_at90usb1286,  device_AVR,  0×2FFB, 0×03eb, 0×1F000, 128, true,  false, 128, 0×0FFF },
    { “at90usb647″,   tar_at90usb647,   device_AVR,  0×2FF9, 0×03eb, 0×0F000, 128, true,  false, 128, 0×07FF },
    { “at90usb646″,   tar_at90usb646,   device_AVR,  0×2FF9, 0×03eb, 0×0F000, 128, true,  false, 128, 0×07FF },
    { “atmega32U6″,   tar_atMega32u6,   device_AVR,  0×2FFB, 0×03eb, 0×07000, 128, true,  false, 128, 0×03FF },
    { “atmega32U4″,   tar_atMega32u4,   device_AVR,  0×2FF4, 0×03eb, 0×07000, 128, true,  false, 128, 0×03FF },
    { “atmega16U4″,   tar_atMega16u4,   device_AVR,  0×2FF3, 0×03eb, 0×03000, 128, true,  false, 128, 0×01FF },
    { “at90usb162″,   tar_at90usb162,   device_AVR,  0×2FFA, 0×03eb, 0×03000, 128, true,  false, 128, 0×01FF },
    { “at90usb82″,    tar_at90usb82,    device_AVR,  0×2FF7, 0×03eb, 0×01000, 128, true,  false, 128, 0×01FF },
    { NULL }
};

Then we test.

static
dfu-programmer atMega32U4 get bootloader-version --debug 20
     target: atMega32U4
    chip_id: 0x2ff4
  vendor_id: 0x03eb
    command: get
      quiet: false
      debug: 20
device_type: AVR
------ command specific below ------
       name: 0

Bootloader Version: 0x00 (0)

(after reading the datasheets for the 3 classes of avr usb chips and looking at the way that the avr-gcc library calls the cpu names there are some changes to the above that I will post later.)

Next up some code.

Tried running up the midiGate software that I wrote last week and found my first bug for the chip in avr-libc

UBRR1 is redefined in iom32u4.h

#define UBRR1 _SFR_MEM16(0xCC)

#define UBRR1L _SFR_MEM8(0xCC)
#define UBRR0 0
#define UBRR1 1
...

Which results in lvalue errors errors when trying to set the register to a given value. Setting the bit values as in some of the other registers seems to resolve this issue.

#define UBRR1 _SFR_MEM16(0xCC)

#define UBRR1L _SFR_MEM8(0xCC)
#define UBRR_0 0
#define UBRR_1 1
#define UBRR_2 2
#define UBRR_3 3
#define UBRR_4 4
#define UBRR_5 5
#define UBRR_6 6
#define UBRR_7 7

#define UBRR1H _SFR_MEM8(0xCD)
#define UBRR_8 0
#define UBRR_9 1
#define UBRR_10 2
#define UBRR_11 3

This is a pretty braindead error so I am sure that its been resolved by now. I need to see if it is fixed in 1.6.3 or the current release candidate (since AvrMacPack is out of sync and has 1.6.2) And yes this is the case.

We have a device!!!

Fix(ing) it!

Both of these issues were easy enough to fix within the source of the utilities but to make it possible for everyone else to use the new chips some body needs to Fix it! So I went about looking up the chain to get these issues resolved over the long run.

Dfu Programmer.

dfu-programmer is a source forge project so I logged an error through the sourceforge project page. https://sourceforge.net/tracker2/?atid=767783&group_id=147246&func=browse A new release has been made (0.5.0) which resolves the issue above.

Avr-Libc

Since avr-libc is a savanaha project and so making bug requests is a little different. http://savannah.nongnu.org/bugs/?group=avr-libc Fortunately (sort of) I had already been around the buggier parts of the release in question (1.6.2) when I first ran up the at90usb647. When Eric Weddington released the June rev of WinAvr (with avr-libc 1.6.3) I thought I had seen the last of it as obdev released the coresponding AvrMacPack. The bug noted above was fixed in 1.6.3 and I was able to verify that using my windows vmware session. For some reason this was not the case and AvrMacPack went out with the buggy (for this new chip anyway) libc. I filed a bug report with obdev and followed up with Christian from obdev and Eric until the version descrepency was resolved. The new version of WinAvr just came out and I am waiting to verify that the AvrMacPack version matches WinAvr.

If you are running linux plan on building from source and patching as in the script kept current at avrfreaks (you will need to log in) . http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631&start=0&postdays=0&postorder=asc&highlight= This script has not been updated for the latest winavr but it should at least give you a version above 1.6.2.

Note the dorkboard….

Ethan and his dad came to the first dorkboard based induction. This is one of his recent projects.

http://etharooni.wordpress.com/2008/09/21/nunchucklogger/

Very cool stuff.

Our first reseller.

Brian Reilly at Wulfden picked up the dorkboard in his freeduino line of products.

http://wulfden.org/TheShoppe/freeduino/dorkboard.shtml

Yeah!

Local Induction.

Why Portland?

I get a lot of people asking what Tempus Dictum does.  What’s the company about?  What do y’all do?  Etc.  And from my friends in Silicon Valley, I often get the question:  Why Portland?

Well, there are many answers to these questions, some of which I’ve covered (albeit in an apparently infuriatingly vague way, according to some) in previous log entries.  I admit this is a problem and we really should work on our … [cough] … messaging.

But, regarding the question of why we’re located in Portland, I can cite at least two things right off the bat:

  1. a do-it-yourself culture, and
  2. beer.

I won’t say anything about the DIY culture this post.  And Portland’s reputation for beer is global.  Now before you jump to the conclusion that we merely have a prurient interest in beer, I’d like to point to this article, which makes an interesting point that speaks directly to everything Tempus Dictum is about, including the English translation of its name “Statement of the Time”.  Civilization is based not on high-falutin’ past times like science, economics, or politics.  Civilization is based on banal things like water, shelter, food, and neighborhoods.  Portland excels at the banal while maintaining a satisficing tendency toward intellectual foresight.  And if Mr. Will is right and beer is positively correlated with civilization, then Portland is one of the most civilized cities on the planet.  Shouldn’t that be enough of a reason?

The Inverse Map

In the course of my duties as a biological modeler (whatever that may mean to you, my dear reader; were you to exist, of course) I am sporadically called upon to wax explanatory on the relation between generators (abbreviated and unitized as “gene” in some domains) and phenomena. The path from generators to phenomena is called the “forward map” and, perhaps obviously, the path from the phenomena back to its causes, the generators, is called the “inverse map”. It is largely the subject of plectics ¹ (a.k.a. complexity theory) to discover, use, and make repeatable, methods for accurately following these two paths. A primary premise of the computationalist approach to plectics is that the forward map is not so straightforward. I.e. beyond a certain degree of simplicity, it is not clear what phenomena will emerge from the generators. And this premise is emphasized because it is so often forgotten. It is the reason Chaos theory, fractals, and games like chess are so maddeningly interesting.

Similarly, the cyberneticists have an emphatic premise: that complexity comes about through feedback loops. Again, beyond a certain degree of simplicity, it is not clear which part of a system is the cause and which is the effect. Phenomena are exacerbated with positive feedback and dampened with negative feedback.

Both emphases are appropriate and the fact that we even have a distinction between computationalists and cyberneticists is an example of specialization gone mad. ² Both require the notion of loopiness and the somewhat occult nature of both the forward and inverse maps. But the loopiness is often a more difficult concept to grasp.

This article challenges the notion that a complex forward map is sufficient to realize or explain a complex system, especially one so full of occult paths and loopiness (including trans-hierarchy) as multi-cellular life. And I am very happy that such an article has made it into the mainstream news.

1. Murray Gell-Mann tried to install “plectics” in the vernacular, but failed. I buy Murray’s argument and try to use “plectics” whenever I can.

2. Not that I would advocate for huge box stores like Wal*Mart where you can buy diapers, car batteries, and bread all in the same trip or anything. In fact, such lack of specialty disgusts me. But there is something to say for, e.g., the general practitioner or renaissance man (sorry, I just can’t replace “man” with “person” in that phrase) who can think holistically … synergistically … about a subject without her (that should make up for the gender bias) prejudices kicking in to keep her from escaping her current thought rut.

Return top