Sunday, October 14, 2012

Felix is Da Man!

And so are Joe and the folks at team Red Bull Stratos!!!  Just a while ago, Felix Baumgartner jumped from a capsule floating ~128,000 feet above sea level and free-fell for over 4 minutes back to earth.  In the process, he broke several records (some of which have been standing for more than 50 years!) and he made it back to terra firma safely.  The jury is still out on whether he broke the speed of sound or not during his free-fall, and he did have some difficulty with his visor heating (it also fogged up during his descent, possibly related to the heating issue, I reckon), but what a fun/amazing thing to watch!

Congrats, Red Bull Stratos!!!

Tuesday, August 14, 2012

Embedded Development is Only Getting More Interesting

With the perpetual trend of more-processing-power-for-your-buck, the space many folks refer to as "embedded" is just getting more and more interesting on the high end.  Processors like the i.MX from Freescale and boards like the Raspberry Pi (both ARM based) can handle a full operating system (like Linux, for example), as opposed to a basic event loop or traditional RTOS.  In addition to providing developers with more "cool things one can do" by having a full OS running, this also opens up a new development "flow": building directly on the board.  It goes like this:

  • write some code
  • compile-and-link it on the OS running on the board
  • run it!
Where before you would need a toolchain with a cross compiler, these embedded devices are now mature (and powerful) enough to support running their own toolchain directly.  You can also do fun things like rebuilding the board's kernel directly on the board!

Another cool development flow which has also gotten popular over the last 5 years or so: building code for embedded devices within a virtual machine (VM).  This flow follows the "cross compiler" model, in that you use a toolchain running on a development platform of different hardware and/or software than your target, embedded device.  But the twist is that the toolchain is installed in its own OS instance inside a virtual machine.  This is very nice because you can use whatever OS you normally like to use (Linux, Mac OS, Windows) as your "host" OS, and then create a "guest" VM with whatever OS and toolchain you need without affecting the "host" OS.  And there are many available-at-no-cost Virtual Machine programs available, too (I personally use VMPlayer under Windows most of the time).  Many developers used to install two-or-more OSes on their development system and dual/multi-boot between them in order to satisfy the need for having a specific toolchain running in a specific OS for doing embedded development, but the use of virtual machines removes the need for having to reboot: multiple OSes can run simultaneously, making it very easy on a developer to get things done (I can tell you from personal experience that having to stop my development so that I can reboot my laptop just so I can check my Outlook calendar for an upcoming meeting notice is very disruptive).  Also, this development flow isn't just awesome for embedded development, it's great when you need to compile code for a different OS that runs on similar hardware.  For example, I can install a 64-bit FreeBSD VM image on my x86 64-bit Windows 7 laptop, write code and compile it there in the VM, copy the generated executables to a x86 system that is running 64-bit FreeBSD as its OS, and it works great!

Seriously, this is cool stuff...

Wednesday, August 1, 2012

The Pi Has Landed!

Been busy lately, but I got real excited to see my Raspberry Pi show up this week!  Newark/Element14 shipped it from South Carolina, arrived in a plan brown envelope with no additional fanfare other than my anticipation...

The board in all its glory!
I downloaded the "wheezy-raspbian" (Debian based) recommended distro (at least recommended to start with), loaded it onto a SD card, popped that puppy in, connected a USB keyboard and mouse, added a network connection, then added necessary power (micro USB supply) and video (HDMI; hooked that bad boy up to my 46" Sony LCD TV), and fired it up!!!

After the usual Linux (3.2.0 kernel) boot messages (as you can see, they didn't quiesce them for this distro, which allows for easy checking of how things are going during boot), you get a nice little ncurses menu.  This menu allows you to do usual things, like set timezone and keyboard type, but also contains handy options, like expanding the rootfs to fill the SD card (so, in cases like mine where my SD card was much larger than the image I loaded, users can now recoup that free/unused space leftover on the card as usable filesystem space!).

Boot time!  The little LEDs closest to the bottom are the Pi!
After this menu, you get the usual Linux command line.  I was able to see, via ifconfig, that my Raspberry Pi had DHCP'd an IP address from my router and could name-resolve and ping google.com!!!  I then ran startx to get the full UI up!

This distro uses the lightweight LXDE interface, which looks great and handles well.  Preloaded on this distro are several lightweight web browsers and some "fun" programming stuff (like Scratch!).  I had no problem firing up one of the web browsers (Midori) and surfing around.

The UI provides tasty Pi experience!
I'm looking forward to digging a little more into the Pi's capabilities and figuring out how/where I might use mine!  :)

Thursday, June 28, 2012

Hot Texas Summer Hybrid Hack

Well, specifically for a 2009 Honda Civic hybrid.  And it's too simple to really consider a hack, but here goes.  When you pull up to a stoplight or stop sign, the car will usually shut off the gas engine and, also, the A/C.  With 100+ degree heat here, you need the A/C, particularly for those LONG lights in rush hour traffic on the way home.  Now the A/C "shutting off" in this Civic isn't as drastic as the A/C shutoff of the "original hybrid" Honda Insight models (as they've been described to me, where the blower/fan shuts off, too) from the early 2000's, the blower/fan is still running in my car when this happens, but the A/C stops cooling.  And things get warm, and fast.  I discovered that if you momentarily release the brake pedal almost to the point where the car is going to start rolling, but not quite, the gas engine kicks back on and you can reapply the brake pedal and sit at the light in comfortable coolness.

Take THAT, summer (and fuel efficiency)!

Wednesday, June 27, 2012

Near Field Communication (NFC) Coming to the New iPhone?

Some buzz has been going around this week about hints that the next iPhone will support Near Field Communication (NFC).  So far, NFC hasn't caught on big in the US, but this could certainly help.  Most of the things we've been told we'll be able to pay for with our smartphones (but, up until now, have been limited to the same things you could buy from your computer browser or the handful of things you can purchase-via-text and have the charge applied on your phone bill) will be possible with NFC.  Think along the lines of waving your phone in front of the soda machine to pay for your drink, paying tolls with a wave of your phone, transferring files to a colleague's phone without having to send an email, etc.

Here's a good, up-to-date list of NFC capable/rumored/retired phones...

Monday, June 25, 2012

Cliff Hanger Flashback

I sat down with my kids this evening to watch the Lupin the Third: The Castle of Cagliostro DVD I had bought for my daughter, who is now very interested in anime.  The opening sequence of the main character and his associate running out of Monaco casino (with cash they had just robbed) left me stunned: I remembered seeing that *exact* same sequence in an old laserdisc-based video game back when I was my daughter's age!!!  Specifically, at the Circus Circus casino in Reno, Nevada.

If you're not familiar with Circus Circus, back in the early 80's it was one of the few places kids could go and play games in Reno.  The first floor was usual, adult gambling.  The second and third floors had carnival midway type games, video games, and a restaurant, from what I remember.  Anyway, around the time Dragon's Lair and Space Ace were popular, we happened to be out in Reno for a SUGI convention my dad was attending.  We (my mom and brother and I) had tagged along and spent time playing games at Circus Circus, which is where I encountered Cliff Hanger.  I played it a bit, I recall getting from the casino to the car, and navigating traffic, not sure if I got beyond that, but it was a fun game.  And I never saw it again, ever.

Even though the gameplay of the handful of laserdisc games which came out in the 80's was somewhat stilted, I always enjoyed how cool it was to "play" a cartoon...

Friday, June 15, 2012

LED-Embedded Wristbands Part of the Show

Saw this article/video concerning a Coldplay concert where the wristbands they handed out to the audience contain LEDs which, at time, blink-in-sync with the music.  Neat idea.  I'd enjoy tearing down one and seeing what kind of micro and communications they used...

Monday, June 11, 2012

Little Victories with My Dymo Letratag "Tape Jam"

So my wife mentioned to me that our little, handheld Dymo Letratag label printer was stuck claiming a "Tape Jam" error.  She and I both looked at it, no tape to be seen jammed.  I poked around online a bit for any advice, all of which I found said "remove jammed tape" (and, sometimes, "clean the head and roller with a cotton swab dipped in alcohol").  I went ahead and cleaned it with the cotton swab, which it probably needed anyway, but no dice: "Tape Jam".  So I tried to manually move the roller with my finger., wondering if the gears were bound in a position that the motor couldn't turn them, triggering the "Tape Jam" error: it wouldn't budge.  Now these consumer-grade label printers are not expensive.  These companies appear to make their money selling the thermal label "tape" cartridges (like printer ink cartridges or razor blades).  So to throw this away and go buy another for $15 or $20 isn't a big deal.  But I like a challenge...

I went ahead and grabbed a small screw driver, removed the 4 AA batteries, and dug in.  After getting every screw I could find out, the motor driving the roller was still pinned in a fairly-inaccessible spot (between the plastic housing and circuit board).  But I could see that the motor uses a worm gear to drive the roller (which explains why I couldn't move the roller manually with my finger!).  I could not physically reach the worm gear (which ruled out me manually turning it with my finger), but I could clearly see it.

After a moment of consideration, I grabbed 2 AAs, wired in series, and two lengths of wire.  I connected one end of each wire to a battery, and then momentarily touched the other ends of the wires to the motor contacts (which were barely accessible to me).  The motor turned!

I (carefully) slapped the whole thing back together, and it was back to working fine!  Assuming the problem was "bound gears", I wonder if I had replaced all 4 AA batteries with fresh ones if the device would have given the motor enough power to "break" the bind...  I'll try that next time!

Wednesday, June 6, 2012

Need to Quickly Generate Some Specific Packets? Scapy!

I came across Scapy a couple of years ago via a coworker.  This Python-based software makes it incredibly easy to craft one (or thousands of!) network packet(s), which makes Scapy one of my favorite tools to "go get" when I'm in need of some specific packet crafting.

Let's say I need to create and send an IP packet to a machine at 1.0.0.2 with the "more frags" flag bit set in the header:


root@dev1:~# scapy
INFO: Can't import python gnuplot wrapper . Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
WARNING: No route found for IPv6 destination :: (no default route?)
INFO: Can't import python Crypto lib. Won't be able to decrypt WEP.
Welcome to Scapy (2.0.1)
>>> mypkt = IP(dst="1.0.0.2")
>>> print mypkt
E@xç
>>> mypkt.display()
###[ IP ]###
  version= 4
  ihl= None
  tos= 0x0
  len= None
  id= 1
  flags=
  frag= 0
  ttl= 64
  proto= ip
  chksum= 0x0
  src= 1.0.0.1
  dst= 1.0.0.2
  options= ''
>>> mypkt.flags = 0x01
>>> mypkt.display()
###[ IP ]###
  version= 4
  ihl= None
  tos= 0x0
  len= None
  id= 1
  flags= MF
  frag= 0
  ttl= 64
  proto= ip
  chksum= 0x0
  src= 1.0.0.1
  dst= 1.0.0.2
  options= ''
>>> send(mypkt)
.
Sent 1 packets.

Cool, huh?

Scapy also has an easy-to-use packet processing function called sniff.  You can pass it an interface to sniff on, a filter (ala tcpdump filter verbiage) to only look at certain packets, and a callback function to send matched packets to.  If one wanted to, say, process LLDP packets on interface eth0 with a function called packetProcess(self, pkt), you could do so by calling sniff like this:

sniff(prn = packetProcess, store = 0, iface = "eth0", filter = "ether proto 0x88cc")

This will call packetProcess for each LLDP (i.e. packets with ethertype 0x88cc) packet seen on eth0.  Note that I say "seen" rather than "ingressing" since sniff() will pickup both ingressing *and* egressing packets on that interface. Also, the "store = 0" above tells Scapy to not store the packet itself, just forward a copy of it to the callback function.

Saturday, June 2, 2012

Dev Kit (and Tools) Pricing Disparities

I find it interesting (and, at times, frustrating) when I come across a vendor who wants to charge $500-$1500 for a development kit, particularly when it's a dev kit for an inexpensive microprocessor.  Of these I've run across, it's never been the case of "well, this kit has all sorts of things which warrant the high cost".  I've seen small startups, who need 4 or 5 dev kits, change their design/architecture decision because of exorbitant dev kit prices (seriously simple math: 5 x $1500 > 5 x $150).  Also, when the dev kit price is high, it makes one wonder what other costs may be lurking ahead (additional toolset license costs, nickel-and-dime structure for purchasing code/stack modules, etc.).  Certainly vendors with lower dev kit costs can have other fees, duh.  It's just a bit much to swallow paying a lot for a dev kit when the microprocessor device will cost you $10 or less.  And with the tools, I absolutely *love* it when a vendor has a free version for me to use that allows code of several KB in size to not require a license.  I think Motorola/Freescale did really well when, back in the day, they started offering CodeWarrior in a model like this.  Tactics like these make products more accessible to small startups, to poor college students, to the professional developer interested in tinkering.  Make no mistake, I'm *happy* to pay for good tools and advanced dev kits once my company has made a decision.  But it can be difficult these days to try and get approval for $1500 to buy a board to "try out" a candidate microprocessor, particularly when there's a suitable candidate with a $100 (or less) dev kit.  I'm just sayin'...

Friday, May 25, 2012

I Really Like aufs...

Being able to overlay a tmpfs on top of a read only file-system is really handy for embedded systems, particularly ones where a read-only device (e.g. ROM) or a limited-write-cycle device (e.g. flash) is used for the root file-system.  To programs running on the device, the file-system appears-and-acts writable, but files created, modified, or removed are done so in a RAM-based tmpfs instead of being persisted to the backing storage device.  Not only does this help increase device write lifetime (in the case of flash), it can also improve device stability in the field.

Certainly there's a number of "union" file-systems out there, but I've had good experiences (and stability) with aufs.

Wednesday, May 23, 2012

Hey, a Browser-based IDE... Wait, What?

A good friend of mine clued me onto an interesting offering from the folks over at mbed: a browser-based IDE for their ARM-based dev boards!  Appears to support syntax highlighting and some version control for your source files, among other things.  Neat!  Now if they could just figure a way to integrate a debugger...

Tuesday, May 22, 2012

TI Still Selling MSP430 Dev Kit for $4.30!

I was pleasantly surprised to see Texas Instruments is still selling their MSP430 LaunchPad dev kit (part of their "value line") for $4.30 (plus shipping).  Great way to affordably tinker around with a handy 16-bit microcontroller, and it comes with Code Composer Studio, a decent (well, for the bit I've tinkered with mine, it seems decent) IDE, too, for creating, compiling, and debugging.  I believe there's also a free version of an IAR IDE available, but I haven't tried it.

Now if I could just get a Rapsberry Pi distributors to sell me a model B board...