|OSTG||| ThinkGeek - Slashdot - IT Product Guide - NewsForge - Linux.com - freshmeat - SourceForge.net - Newsletters - TechJobs - Broadband||Search »|
|Log in - Create Account|
Wednesday April 16, 2003 - [ 03:00 AM GMT ]
by Nicholas Carroll
Embeddable chips. Like the insects of the computer world, proliferating steadily, pollinating flowers, hauling away garbage, and occasionally stinging us, they are embedded everywhere uncool, uninteresting, and eminently forgettable, until your car's fuel injection logic fails in the passing lane. But times have changed, and Micro Controller Units likewise. With many of them essentially miniature motherboards, some even remotely programmable by modem, they are no longer a “fire and forget” piece of hardwiring, a bore you stuff under a car's dashboard and ignore.
Why be surprised? Puny PDPs replaced 360s; DECs replaced PDPs; Sparcs replaced DECs. Today? Even smaller Pentiums running Linux, racked in parallel, could be called today's big iron. As x86 chips evolved along the lines of Moore's Law, so have the components of MCUs.
Before anyone charges the microphone to shout "disruptive technology!"-- a la The Innovator's Dilemma -- let us remember that Clayton Christensen's disruptive technologies took decades to replace the market leaders. (And after the Japanese motorcycles had taken over the marketplace, the hogs returned in force anyway.)
No, MCUs won't replace x86 CPUs overnight, if ever; in fact, with short-range modems now in the 5-cent range, and short-range transmission standards settling into place, a new form of client-server relationship may evolve.
Developers who have never run at the bare metal are
about to live in interesting times. Many of these babies -- perhaps
half -- don't even have
Since MCUs are primarily stand-alones, expected to not only process data but generally to control devices as well, they necessarily have more on the board than just a CPU and some memory. A typical MCU might have a 25MHz 8-bit CPU, 32k of memory, a clock, often an A/D converter, ports (serial or parallel), and the ability to generate analog signals (D/A converters or similar). Some MCUs have connectivity to Ethernet cards for TCP/IP based connections to PCs and other hosts. Others sport microcontrollers that have audio/video output.
Someone really determined to build from scratch could build a CPU from an FPGA. But it's not a good idea. Most MCUs have a processor, whether a very cheap ASIC, or a more robust ARM or 8051 series. They range from 4 to 16-bit, most of them being CISC rather than RISC, even in battery powered devices. (This might seem nutty given CISCs' reputation as power hogs, but remember that busses are power hogs too, and a RISC in the wrong place can work the bus pretty hard.)
Admittedly some of the larger embeddable chips make the stretch for bloat-land, stuffing Java in a matchbox, but 32K of memory is fairly typical. The world's best garbage collection still doesn't allow for anything but very tight code.Reprogrammable MCUs
In MCU-land, "reprogammable" can have several meanings. The chip might be 90% reprogrammable by modem. Or you might have to plug a control device into a socket. In the latter case, this is definitely a world of thinking ahead. But in either case, there is usually not enough memory to be coding around bugs. You get it right before you embed.
MCUs involve a shift in thinking. Because their limitations restrict most of them to running on C or assembler, coding to most MCUs is definitely running at or near the bare metal. When they become reprogrammable, I'd call it "running at the molten metal."
In fact reprogrammable MCUs push a developer halfway into the realm of chip design, and it is said that chip designers are born, not made. Some coders will be wired for it, some won't.
(Marketing departments have gotten a bit careless in their product terminology, so "programmable" -- what MCU isn't, unless it's completely hardburned? -- could mean anything from programmable once to reprogrammable on the bench to reprogrammable by modem. Likewise configurable or re-configurable. To one company this means the software is re-configurable, to the next company it means the hardware is.)The Analog Divide
The digital/analog MCUs are particularly fascinating, in that where digital data processing is a second-tier representation of reality, analog is the electrical real-time expression of reality.
Analog? Analog is unreliable, right? That's why computers are binary, isn't it? In fact digital was once unreliable, hence the "tell me thrice" rule of early digital error-checking. A reading of Robert Maxwell reveals that electricity is not at all a simple yes/no, positive/negative world. Electrons have multiple states, and that is precisely why computers went digital -- the early analog computers of the 1950s, though they worked, had to be manufactured to much more precise (expensive) tolerances. So computing took the digital path, and all was forcibly reduced to binary logic. With manufacturing costs plummeting, precise analog chips have now become affordable.A Question of Speed and Versatility
Once you get past how difficult chip design can be, the brains are in the software. After all, even a latest-generation x86 CPU with nothing but BIOS available isn't much smarter than an earthworm. Which is as it should be, since x86s are built for versatility more than speed, clock-rate wars notwithstanding.
Software is also where the stupidity lies. When a bloatware app runs slower from hard drive than SRI's 1968 oNLineSystem did with a 1200 baud client-server connection, it is time to start wondering what clock speed is worth. A two-second wait for a word processor app to reveal its style menu is annoying; a two-second wait for your anti-lock brakes to kick in is a fine reminder that "interactive" means "right now!" An MCU with a 25MHz clock rate might seem laughable at first, until you see how fast these critters can respond in realtime.
The trade-off, of course, is speed vs. flexibility. An MCU gets its response time from dedicated design and lean code, and cannot match the versatility of an x86 box.
Or can it? MCUs have gotten a lot smarter in the last few years. Some industrial-strength MCUs can run on networks, controlling and monitoring video terminals with sophisticated GUIs. When they are remotely reprogrammable via modem or Ethernet, they become a living component of a device. The "expert within" the coding can be altered to adjust to new conditions. This gives the programmer far more latitude to anticipate contingencies. When situation A changes to situation B, the chip can morph to new logic.
Aside from increased flexibility, this makes reprogrammable MCUs a two-for-the-price-of-one solution -- or better. They won't run an officeware suite -- but they might do everything you really need done.Conclusion
At first glance MCUs are a harsh world for programmers who started on Java or Perl. There is no place to store a 500kb interpreter, much less a full OS.
In some ways this is counter-intuitive for anyone who learned programming after 1970, we are so used to having an OS. But computers don't strictly need an OS to operate, in fact the early ones didn't have an OS at all. Far from being a constraint, there's a certain feeling of freedom designing logic in a world where you make your own rules, and almost all the logic all belongs to you.
For those inclined to download a developer's kit, and roll their own mini-motherboard, there is definitely fun to be had at the bare metal.Uses For MCUs
Some of these devices are off-the-shelf, others are geekware which engineers assembled in their spare time for fun, and certainly were not cost-effective. However -- today's experiment is tomorrow's production item.
XML processing. Cheap MCUs can render analog input to digital and then into XML for immediate upload by modem, or later plug-in upload, or for realtime transfer on a network. This usage goes beyond cars or factories; any number of field devices from medical monitors to geologists' spectral analyzers may be using them soon.
Wireless data acquisition, such as Ericsson's ROK 101 007 module. MCUs are and will continue to be a vital part of "the wireless Web."
And for those who insist on Java at JRealTime, you can buy a "JStamp" 32-bit native Java MCU with up to 2mb flash memory for under $100. For a truly geekish application, don't miss the "Sumo robots."Engineers Having Fun
Remote building control with SMS. An article describing how an engineer made a friend's business controllable through his cellular phone.
Web link monitoring system that pops up warning flags on any browser when it receives signals from remote monitoring devices. Like the previous example, this was an engineer experimenting. Code and parts list are here (105 files in that zip file. Can't complain about a lack of docs or demos).
Digital Joystick. An engineer got tired of replacing joysticks when the potentiometers wore out, so he built one with magnets and Hall effect switches feeding an Atmel AT90S4414 MCU.Glossary of MCU Terms
Chip and Software Roundup
These are some of the leading manufacturers of MCU boards. Most have a core product such as a processor or FPGA that they build on with other manufacturer's components.Digital Chips
Note: though I've yet to see an MCU that will run Linux, I was happy to find that some of these OSs use the GCC compiler.Online Resources
© Hastings Research 2003. All rights reserved.