Go here to sign up for The Embedded Muse.
TEM Logo The Embedded Muse
Issue Number 291, September 21, 2015
Copyright 2015 The Ganssle Group

Editor: Jack Ganssle, jack@ganssle.com
   Jack Ganssle, Editor of The Embedded Muse

You may redistribute this newsletter for noncommercial purposes. For commercial use contact jack@ganssle.com.

Contents
Editor's Notes

Async activities sure to cause your code to crash

Suppose you're running a 16 bit CPU with a 16 bit timer, but want to accumulate time, in ticks, to more bits. Typically we'd interrupt when the timer overflows and increment a value in memory. When the code needs the time, it concatenates the memory value and the current hardware timer register. About 80% of the code I read that does this is written naively. It works, most of the time, but is guaranteed to fail. This is just one of many subjects covered in my one-day Better Firmware Faster seminar. It delves into technical and process issues to give your team the training they need to operate at a measurably world-class level, producing code with far fewer bugs in less time. It's fast-paced, fun, and uniquely covers the issues faced by embedded developers. Information here shows how your team can benefit by having this seminar presented at your facility.

Better Firmware Faster in Australia and New Zealand: I've done public versions of this class in Europe and India a number of times. Now, for the first time, I'm bringing it to Sydney on November 9 and Auckland on November 16. There's more information here. Seating is limited so sign up early.

Better Firmware Faster in Maryland: I'm giving this class at The Barr Group's facility in Germantown on November 2, 2015.

Firmware practices survey: Are you agile or traditional? Do you track requirements or not? I'm doing a survey of how teams develop firmware. It will take just a minute or two to complete, and I'll share the results in the Muse next month. You have a chance to win one of three copies of "The Embedded Systems Dictionary."

Undecidability is a fundamental limitation that prevents any static analysis tool, no matter how sophisticated, from guaranteeing 100% enforcement of certain types of coding standard rules, or from fully and precisely identifying all instances of certain types of software defects.

In this free webinar, Fulvio Baccaglini, Senior Software Developer and member of the MISRA C Working Group, will explain:

  • The principles behind undecidability
  • How undecidability affects static analysis
  • How to recognise undecidable rules
  • Mechanisms to deal with undecidability

Register for our webinar on Wednesday, September 30
9:00 BST- 10:00 CEST - 13:30 IST - 16:00 CST - 17:00 KST/JST or http://www.programmingresearch.com/hidden/em-undecidability-morning/
9:00 PDT - 11:00 CDT - 12:00 (noon) EDT - 17:00 BST - 18:00 CEST or http://www.programmingresearch.com/hidden/em-undecidability-afternoon/

Embedded Video

The latest video is a review of the $50 signal generator that was last month's giveaway. The thing has its faults, but offers a lot for fifty bucks.

Quotes and Thoughts

The sooner you start to code, the longer the program will take. - Roy Carls

Tools and Tips

Please submit clever ideas or thoughts about tools, techniques and resources you love or hate. Here are the tool reviews submitted in the past.

Freebies and Discounts

Real-Time Current Monitor

This month I'm giving away a Real-Time Current Monitor, which was kindly provided by ee-quipment. I reviewed it here, and think it's a great tool for measuring current consumption in a system where that changes drastically and frequently, like in a system going in and out of various sleep modes, or sporadically initiating communications.

The contest will close at the end of September, 2015. It's just a matter of filling out your email address. As always, that will be used only for the giveaway. Enter via this link.

Prototyping With SMT Components

In the last issue a lot of readers wrote in with their techniques for dealing with SMT components. This is a hot topic! Here are some more ideas.

Chris Stockbridge wrote:

I saw a lot of recommendations for low volume PCBs on the last news letter, and I would like to recommend one more for people to try: I have been very happy working with Seeed Studio. In addition to their PCB service they also offer an assembly service for $0.10 per solder joint. You must use parts that they they stock in their Open Parts List but they have a big selection. There are also Eagle footprints for most of the parts, but the quality of the Eagle library is not consistent. I haven't seen this service reviewed in many places, but after ordering one batch of 4 boards I was very happy. My order cost a total of $83 shipped for boards with 11 unique line items. The parts cost is low, and this could save a lot of headaches. Even if you have a unique part or two that you need to hand solder it is nice to have someone else place the voltage regulators, resistors and caps for you. I can't believe I haven't heard more about this service. The only down side I saw from working with then was the timeline. My boards got held up because I specified a wrong part number (40 pin male header instead of 4 pin), and everything just sat until I emailed asking about it. Normally the assembly service should only add one day on top of the board fabrication.

In The Embedded Muse 290, Sean Newton wrote: "Buy a stencil for your board (~$60-100 per board design depending on the size of your board)". Stencils are not that expensive. On my forum, there is a collection of links for cheap sources at http://liteplacer.com/phpBB/viewtopic.php?f=8&t=83 and another thread with good links about DIY stencils, http://liteplacer.com/phpBB/viewtopic.php?f=8&t=22 .

Paul Carpenter sent this:

If doing simple proof of concept I have been know to create a stripboard and Schmart board mix like this USB 2 hub, USB device and PLD plus ancillary oscillators and minor components including I2C controller in PLD to 2MHz.

I rarely do anything not on a PCB with surface mount including QFN/QFP with exposed pads underneath. These days in Europe I use places like Beta Layout (www.beta-layout.com) and multi-circuit-boards (www.multi-circuit-boards.eu) as they can take board files produce PCBs in 1-15 days, and often with FREE stainless steel stencils 250 um thick. They also offer stencil services from your board files for different thicknesses and materials.

For small prototype or in some cases small production runs I have a small kit for an oven and controller takes boards up to 29 cm x 29 cm. Yes, I have done some boards that nearly filled the oven as well. The company's latest starter kit (oven, controller, paste and tools) includes a magnetic SMD stencil block for aligning stencil and applying paste. Around 400 EUR plus taxes and shipping for EU and North America.

Manuals available online as well.

Placing 0402 SMD and QFN down to a a few mm across is possible using magnifiers/microscope with DAYLIGHT phosphor tubes and tweezers that grip and push to release component. Some people use small hand vacuum pumps size of large pens, but I find changing nozzles and keeping them clean sometimes awkward as the vacuum is not great on most.

I have been doing this for years and have not tried BGA/WLCSP devices yet. Still find the odd component that did a 'Thelma and Louise' and decided not to stay in the tweezers, but unless it is an expensive device just find another one to use. Hunting for 0402 resistor is pointless they travel a long way.

Gary Crowell wrote:

In your recent Muse, several people mentioned reflow ovens for prototype work. I'd like to point out the Zallus reflow oven controller -- I've looked at quite a few of the DIY controllers over the past few years, and the Zallus is hands down the best controller for adapting a toaster oven for reflow work. I'd bet that it's more versatile and user friendly than the controllers on the low-end Chinese reflow ovens. It's a bare board, but there are printable enclosures for it on Thingiverse.

Paul Bennett contributed this:

If the number of components and boards is small and you don't feel like it is worth shelling out to purchase services or the specialist equipment it is possible to achieve reasonable results by hand. I have managed to do this on a small board with about 10 surface mount components.

You will need an illuminated magnifier, I use one of the Anglepoise devices. This helps you see what you are touching the iron onto. Components like capacitors and resistors are not the problem. It is the multi-pin devices like the chips that pose the biggest concern. Here I find that so long as the chip is properly located (a bit of double side tape underneath can help) and you have a reasonable solder screen already on the board, then flooding the pins en-masse with solder is the first step. Follow this with applying solder-wick and extracting the excess solder into the wick. This will leave all the pins individually soldered down and the inter-pin spaces clean of solder.

Steve Taylor has a tutorial:

Necessity being the mother of invention, I had to make a solder stencil for a PCB in a tearing hurry. I used my laser cutter, and documented the process here: http://www.instructables.com/id/Soldering-stencils-for-DIY-circuit-boards/ .

ARM Assembly Language

ARM Assembly Language (Fundamentals and Techniques), by William Hohl and Christopher Hinds, is a 400 page textbook on exactly what you'd expect. While virtually everyone in the embedded world is using C/C++ on ARM processors, a little assembly always seems to creep in. And, we really need to understand a processor's architecture to effectively manage interrupts and the like.

As mentioned, this is a textbook, and as such every chapter ends with sample problems.

The focus is on the ARM7TDMI and Cortex M4 architectures. This covers a very broad space as the M4 runs a superset of the instructions available on lower-end M-series devices. Thumb and Thumb 2 instructions get as much attention as does the ARM ISA.

The book is practical, as it describes the use of the Code Composer and Keil tools. I wish it gave at least some attention to GCC as a lot of developers use those.

Three chapters delve deeply into floating point (only one of these covers ARM's floating-point instructions). This is important stuff, as the IEEE-795 format has all sorts of quirks that the authors explore at length.

The two chapters (one per ISA) on exception handling are very complete and do cover some of the hardware issues like the fast-interrupt (FIQ).

One chapter covers several actual processors and writing code to drive their peripherals. That's probably not useful for us pros, since it's unlikely we'd use the same MCUs, but is appropriate for a university setting where students probably have had little exposure to real hardware.

I was surprised, and disappointed, that there's no instruction set summary. Instead, instructions are introduced as needed, rather like one would expect in a college course. But a reference is important, because memories are fallible and combing through 400 pages of text to tease out which instruction you've forgotten is just not efficient. Not all instructions are covered; there's nothing on the SIMD variants.

This is a great book for students, and is good for someone just starting out with the ARM parts. But it's no reference, and needs to be supplemented with an ISA summary. It drives me crazy that books are so expensive, and at $86 this is no exception, but the authors have no control over these publishing decisions.

Squaring Square Waves

I sometimes need a square wave or pulse signal with really sharp edges. But all of the DDS signal generators I've tested are pretty slow; generally rise times are 10 ns or worse. My most recent video is a review of a $50 unit whose rise time was nearly 40 ns, and the one I used in this example measures 17 ns. So I built the following some time ago to sharpen things up:

Scope of 74AUC08 rise time

The BNC on the left goes to the signal generator output, and the one on the right is the device's output. The two clip leads go to a power supply.

It's basically just a 74AUC1G08 AND gate, which is the fastest TTL gate I can find. TI specs the propagation delay at 0.2 to 1.6 ns at 2.5 volts, but gives no figures for rise time. My MSO-X-3054A scope pegged that at just over a nanosecond:

Rise time out of a 74AUC08

But that is certainly an incorrect reading, as this is a 500 MHz scope. I suspect the rise time is better than the measured value.

High-Speed Digital Design, my goto book for all things fast, gives a rule of thumb for frequency components in square waves: F= 0.5/tr, where tr is the rise time, and F is the frequency at which all higher harmonics are at least 40 dBV down. I connected the squarer circuit to my spectrum analyzer, and got this:

Spectrum analyzer view of 74AUC08 rise time

In this case 680 MHz is the -40 dBV point. That works out to 735 picoseconds, which is probably closer to the real value than that displayed on the scope. Now, the formula is a rule of thumb rather than a law of nature, but it gives a satisfying result.

The 74AUCG08 is powered from a bench supply, but if I were doing it again I'd use a CR2032 battery and a linear regulator.

If your signal generator has sluggish transition times, a few bucks worth of parts will really improve its performance. But be careful to set the generator's offset so it produces a waveform that goes from 0 to 2.5 volts, because most will, sans offset, swing equally positive and negative.

Jobs!

Let me know if you’re hiring embedded engineers. No recruiters please, and I reserve the right to edit ads to fit the format and intents of this newsletter. Please keep it to 100 words. There is no charge for a job ad.

Joke For The Week

Note: These jokes are archived at www.ganssle.com/jokes.htm.

Jon Woellhaf sent this:

Larry Rachman's great DRAM story (in Embedded Muse 289) reminded me of my favorite board assembly error. When I was a test and repair technician, I happened to notice a diode had been soldered in reversed. But the board tested good! It couldn't, not with that diode reversed, so I investigated. I removed the diode and tested it. It was marked backwards! What is the probability a diode would be marked incorrectly and then installed (by hand) incorrectly?

Advertise With Us

Advertise in The Embedded Muse! Over 25,000 embedded developers get this twice-monthly publication. .

About The Embedded Muse

The Embedded Muse is Jack Ganssle's newsletter. Send complaints, comments, and contributions to me at jack@ganssle.com.

The Embedded Muse is supported by The Ganssle Group, whose mission is to help embedded folks get better products to market faster.