Embedded Muse 103 Copyright 2004 TGG October 6, 2004
You may redistribute this newsletter for noncommercial purposes. For commercial use contact firstname.lastname@example.org.
EDITOR: Jack Ganssle, email@example.com
- Editorís Notes
- Interesting Factoid
- Note on a VCS
- Strange Behavior During Reset
- More on Eyeglasses
- Joke for the Week
- About The Embedded Muse
I presented a class about building projects at last monthís Embedded Systems Conference. A number of attendees later contacted me and complained that their bosses just donít ďget it.Ē They donít understand the issues and are too busy to learn about firmware engineering. So Iíve distilled some thoughts into a short paper, A Bossís Guide to Firmware Engineering, which is available at http://www.ganssle.com/bossguide.pdf. Print it out and slip it under your bossís door!
Scheduling is a huge concern for developers today. Few get it right. Iíve added a significant section on scheduling to my one-day Better Firmware Faster class, which is offered in Boston on November 1 and in Las Vegas December 10. This is the only non-vendor class that shows practical, hard-hitting ways to get your products out much faster with fewer bugs. 80% of systems get delivered late, often hopelessly bug-ridden. It *is* possible to do better Ė much better.
See http://www.ganssle.com/classes.htm for more details. Thereís also cheap fly-in options listed on the web site for folks coming from out-of-town.
But register soon - my able assistant cleverly negotiated free hotel rooms for the first 15 people to sign up at each venue.
I often do this seminar on-site, for companies with a dozen or more embedded folks whoíd like to learn more efficient ways to build firmware. See http://www.ganssle.com/onsite.htm.
Iíll be at Electronica/The Embedded Systems Conference in Munich from November 9 to the 11th, presenting three talks. If youíre there, stop by and say ďhi!Ē
Iíve seen anecdotal evidence that firmware size doubles every 18 months, but Reiner Hartenstein, in the April 2004 Proceedings of the First Conference on Computing Frontiers claims that embedded software doubles in size (lines of code) every 10 months, and will reach 90% of all software being written by 2010.
That number surely bodes well for the future of firmware engineers!
Note on a VCS
Simon Large wrote in with some interesting comments about an open source version control system:
In my previous company I used Visual SourceSafe (VSS) all the time. When I changed jobs, the new company (managed by mechanical engineers) could not accept that a VCS was better than using WinZip periodically, and would not pay. As a result, I trawled around the open source sites and came across Subversion. This project was started in around 2000 as a replacement for the ageing CVS system widely used by the open source community, but rather limited in scope. You can read the history for yourself on their site, but it is now widely deployed and seems well regarded.
Many of the enhancements over CVS also apply with regard to VSS, but in particular:
* Atomic commits - A change often involves several files. In this system you check them all in together in one operation with a single log message. If any file fails, the whole commit fails, so you don't end up with the repository in a half-changed state.
* Ported to many OSes - The server component is based on the Apache web server and will run on a wide variety of machines. Likewise the client.
* Flexibility - You can also use the client standalone on a local PC; or several clients on a network share; or you can set up a server and access over LAN or the Internet using Apache's security.
* Works with large databases - VSS is notorious for database corruption when the number of files rises. Subversion is being used to store multi Gigabyte projects (not embedded!!!)
* Free! - VSS costs around $300 per user, and if you want to use it over the internet you need something like SourceOffsite, also around $300. Perforce is also highly regarded, but costs around $750 per user (although to be fair you can use Perforce for free, but restricted to 2 users and 2 working directories).
* Support - There is an active mailing list and you get good technical info quickly (unlike many mailing lists where you just get "this product is cool/this product sucks" with zero information content).
The standard client is a command line interface, but of particular interest to Windows users is the TortoiseSVN client. This integrates into Windows explorer as a shell extension and you get VCS instantly in your right mouse context menu. It is very easy to use and the documentation is excellent (I have to say that because, like Victor Kiam, I was so impressed I joined the TSVN project). If you don't need the server component, TSVN is all you need to download.
Also of interest to you, project rules which govern how changes are made to the project code and documentation are a model of good software practice. ALL changes are reviewed by the development team, and they are really picky about quality of comments as well as the code itself.
This has come across as more of a sales pitch than I originally intended, but when I see a good product which can be of real help to other engineers I like to tell them about it.
The main subversion website is at http://subversion.tigris.org
The TortoiseSVN (Windows client) is at http://tortoisesvn.tigris.org
Strange Behavior During Reset
Itís frustrating that databooks today offer tons of info about programming on-chip peripherals and the like, but not nearly enough about electrical behavior in each mode. RESET is particularly problematic; vendors seem to think itís something that happens only once on power-up for a few msec so why document much about whatís going on? Yet in my career Iíve seen too many weird reset-related events.
On some processors RESET has funny voltage requirements; on others the timing is critical. The requirements, if listed at all, are buried deep into the AC/DC and timing specs. The moral is to read every word of the datasheet.
On one system a sub-nanosecond glitch on RESET that the scope rarely captured caused the CPU to boot up in erratically-strange ways. Sometimes on-board peripherals were confused, and only another hard, legal, reset fixed things.
Some inputs Ė RESET, clock, wait Ė just donít tolerate any weirdness. If theyíre not perfect, expect erratic and unpredictable system operation.
Phil Ouellette of Mettler-Toledo, Inc ran into an interesting behavior of an 8051 while itís in the reset state:
Wanted to share something that I recently discovered about interfacing the venerable old 8051 processor to external memory. You probably are already aware of this, but it caught me by surprise and nobody I talked to here at work had ever noticed this before (in fact I had a hard time convincing several of the other engineers when I tried to explain this to them).
I had a problem with a USB powered product that contained an 8052 with external memory and memory mapped I/O. I used 74VHC573 latches to decode the address/data and for the memory mapped I/O. So far pretty vanilla stuff.
I discovered an interesting problem where the current consumption of the system more than doubled (from 35 mA to 80 or 90 mA) while the processor was in reset. Usually it would be easy to miss this or write it off as capacitor inrush because the product comes out of reset so quickly, but we had an unusual power supply in this design: USB power feeding a 3.3V LDO that in turn fed a charge pump regulator to provide a regulated +5V supply. The +5V charge pump was OK with the extra current draw, but due to losses in the charge pump (plus the increased current required to step 3.3V up to 5V) that extra 40 to 50 mA from the +5V supply turned into an extra 80 to 100 mA from the 3.3V supply. The 3.3V regulator was unable to supply the unexpected current and the 3.3V supply voltage only came up to 2.9V. The charge pump was unable only able to output 4.5V from the 2.9V input and this prevented the reset chip from coming out of reset which would clear the problem. A Catch 22 situation.
To make a long story short, what was happening was that the VHC573 latches were consuming between 20 to 25 mA of current each while the processor was in reset. The reason why this was happening was because the Port 0 I/O pins on the 8052 go into a tri-state condition while the processor is in reset (no weak pull-ups on Port 0) and the latches don't behave properly with their inputs floating. Disabling the Output_Enable and Latch_Enable inputs on the latches or disconnecting the latches outputs themselves did nothing to reduce the excess current consumption.
The solution was to add pull-up resistors to the Port 0 I/O pins. In normal operation these pins don't require pull-ups, but they were mandatory to prevent the extra current draw during reset. We have scores of 8051 designs dating back 20+ years that use external memory or memory mapped I/O and have never noticed this behavior before (if we look, I'm sure we will see it).
With most '52 variants now sport large internal memory perhaps this will never come up for anyone else, but it came as un unpleasant surprise to me. The processor's manuals I examined (Intel, Philips and Atmel) describe in intimate detail how the processor behaves on exiting reset, but say almost nothing about what happens while the processor is actually in reset.
More on Eyeglasses
Steve Litt of Troubleshooters.com wrote in response to my bemused ramblings on eyeglasses and Britney Spears in the last Muse:
I have a theory about this. 200,000 years ago, people with bad eyes couldn't see the lion until it was within striking distance. All the people with bad eyes were killed except for those smart enough to figure alternate defense systems (look through pinholes made by their fingers, follow in the footsteps of a more succulent animal, whatever). As a result, survival of the fittest bonded myopia and intelligence. Now that glasses are invented, that bond will slowly be broken over the next 100,000 years or whatever.
When you invent a time machine and take a time trip to 100,000 AD, the people with glasses will be as dumb as those without.
Joke for the Week
If Abbott and Costello were still around today their famous sketch
"Who's on first?" might have turned out something like this....
COSTELLO CALLS TO BUY A COMPUTER FROM ABBOTT
ABBOTT: Super Duper computer store. Can I help you?
COSTELLO: Thanks. I'm setting up an office in my den and I'm thinking about buying a computer.
COSTELLO: No, the name's Lou.
ABBOTT: Your computer?
COSTELLO: I don't own a computer. I want to buy one.
COSTELLO: I told you, my name's Lou.
ABBOTT: What about Windows?
COSTELLO: Why? Will it get stuffy in here?
ABBOTT: Do you want a computer with Windows?
COSTELLO: I don't know. What will I see when I look in the windows?
COSTELLO: Never mind the windows. I need a computer and software.
ABBOTT: Software for Windows?
COSTELLO: No. On the computer! I need something I can use to write proposals, track expenses and run my business. What have you got?
COSTELLO: Yeah, for my office. Can you recommend anything?
ABBOTT: I just did.
COSTELLO: You just did what?
ABBOTT: Recommend something.
COSTELLO: You recommended something?
COSTELLO: For my office?
COSTELLO: OK, what did you recommend for my office?
COSTELLO: Yes, for my office!
ABBOTT: I recommend Office with Windows.
COSTELLO: I already have an office with windows! OK, letís just say I'm sitting at my computer and I want to type a proposal. What do I need?
COSTELLO: What word?
ABBOTT: Word in Office.
COSTELLO: The only word in office is office.
ABBOTT: The Word in Office for Windows.
COSTELLO: Which word in office for windows?
ABBOTT: The Word you get when you click the blue "W".
COSTELLO: I'm going to click your blue "w" if you don't start with some straight answers. OK, forget that. Can I watch movies on the Internet?
ABBOTT: Yes, you want Real One.
COSTELLO: Maybe a real one, maybe a cartoon. What I watch is none of your business. Just tell me what I need!
ABBOTT: Real One.
COSTELLO: If it's a long movie I also want to see reel 2, 3 & 4. Can I watch them?
ABBOTT: Of course.
COSTELLO: Great! With what?
ABBOTT: Real One.
COSTELLO: OK, I'm at my computer and I want to watch a movie. What do I do?
ABBOTT: You click the blue "1".
COSTELLO: I click the blue one what?
ABBOTT: The blue "1".
COSTELLO: Is that different from the blue w?
ABBOTT: The blue "1" is Real One and the blue "W" is Word.
COSTELLO: What word?
ABBOTT: The Word in Office for Windows.
COSTELLO: But there are three words in "office for windows"!
ABBOTT: No, just one. But it's the most popular Word in the world.
COSTELLO: It is?
ABBOTT: Yes, but to be fair, there aren't many other Words left. It pretty much wiped out all the other Words out there.
COSTELLO: And that word is real one?
ABBOTT: Real One has nothing to do with Word. Real One isn't even part of Office.
COSTELLO: STOP! Don't start that again. What about financial bookkeeping? You have anything I can track my money with?
COSTELLO: That's right. What do you have?
COSTELLO: I need money to track my money?
ABBOTT: It comes bundled with your computer
COSTELLO: What's bundled with my computer?
COSTELLO: Money comes with my computer?
ABBOTT: Yes. No extra charge.
COSTELLO: I get a bundle of money with my computer? How much?
ABBOTT: One copy.
COSTELLO: Isn't it illegal to copy money?
ABBOTT: Microsoft gave us a license to copy money.
COSTELLO: They can give you a license to copy money?
ABBOTT: Why not? THEY OWN IT!
A FEW DAYS LATER . . .
ABBOTT: Super Duper computer store. Can I help you?
COSTELLO: How do I turn my computer off?
ABBOTT: Click on "START"..........