Friday, December 21, 2007

Holiday Hackery



I received a couple of GPS modules from Ebay over the last couple of days. Along with the ARM board I'm diddling with, I plan to make a device that helps me map my bike rides and walks (both of which are helping me regain proper control of the ankle I had fixed). One of them came with an amplified antenna, so now I have all I need to get my project hacked together. The board pictured is part of an evaluation kit that came with a ridiculously long antenna cable. I'll probably ultimately replace it with a little ceramic patch antenna, but for testing the software and experimenting, this will work fine.

Ebay is a wonderland. I have bought thousands of dollars worth of electronic and scientific gee-gaws for a hundred bucks or so total. It takes a certain amount of determination to find what you want in a form you can use. But I have found super nerdilicious bargains. There is a subculture on Ebay of hackers looking to buy and sell techno goodies, and the best of them will include links to manuals and datasheets. I was able to find all the data on the GPS modules this way, so I knew what I would have to hook up, and how I would need to communicate with the boards long before they arrived.

I plan to spend my free minutes over the Christmas holiday working on making this stuff talk, and gathering data. I saved some vacation time so I could hang out with the family, but after they go to bed, I commence to programming and soldering. And they all like to sleep in, so I have some time in the morning. I should be thoroughly exhausted by the time I have to go back to work. It will be glorious...

Labels:

Monday, December 10, 2007

Oww, my head...


Luminary Micros board
Originally uploaded by sciencedave

I have a Mac and several PCs at home. I like my Mac, and usually, it's the only computer that I use at home, because the others are busy looking up ancient ancestors or fighting aliens.

One of my hobbies is programming little single board computers to do nerdariffic things. The one in the photo is especially cool. I won't geek-speak about the details, but I got it for around 50 bucks from a company called Luminary Micros, if anyone is interested. I really like the organic LED display- it is 128x64 pixels, and each pixel can be one of 16 shades of gray. The program running on the board in this picture is just presenting text (and is related to the headache I have), but I have written a Java program that allows me to design graphics for the display.

Macs are not all that popular amongst the engineering crowd, and development boards like this are almost never provided with drivers or software to communicate to a Mac. My goal of using this board (to connect to a GPS, and do some cool stuff) has been stymied for several weeks as I figured out what the hell I needed to do to to make the damned thing talk to the Mac. It talks sweetly to my Dell laptop. But it has nothing for my beloved Apple.

First, I spent a bunch of time trolling message boards and looking for drivers on the manufacturers site. I listened to a bunch of anti-Mac trash talk, but I no longer participate in the techno-religious wars, so I just look for info and go on.

Staring at the board and the schematic revealed that the USB chip is from FTDI, and hot damn, they had drivers for OS X on their website! Which seemed to do exactly nothing. Hmm.

Every chip has a long and boring booklet associated with it called a 'data sheet'. It most assuredly is not a sheet. It is a book. A fairly short, but incredibly dense book full of lots of obscure talk about all the detail necessary to use a chip. They are great when you know what piece of data you are looking for, and indispensable if you plan to actually design something yourself. I just wanted to know why the @#$!% thing wasn't recognized by my Mac.

It turns out that USB is really weird, and every commercial piece of USB equipment has unique ID. This ID is used by the operating system to load the proper driver when you plug in the USB thingy you want to use. The FTDI chip has its own ID, and drivers, but can read external memory and use data there to provide a unique ID for an application.

So, the Luminary board has its own ID. Luckily, I had stumbled on the System Profiler utility on the Mac before, so I recalled seeing lots of data on hardware. When I looked, the info for the luminary board was there. I didn't know what to do with it, but it was there.

After some flailing, I saw a site that had a workaround for using a USB weather station that has an FTDI chip in it. It detailed how to edit a file so that the Mac would recognize the device.

So I tried this, carefully studying examples and copying the data I had found into the right places, and it kinda, sorta worked. But not really. The Mac saw the board, but couldn't talk to it.

So I pored over data that Luminary Micros provided. Finally, I saw it. There are TWO channels in the USB chip. The first is used as a programmer for the chip. The second, ta daa, handles serial communication.

So I changed the file to reflect this arcane bit of knowledge, and it worked. My ears are still ringing from the adrenaline. I choked the mother of 12 bastards to the ground and made it work. Whoo Hooo!

Now, just a couple of months of hair pulling, and I should have this thing done.