Tuesday, July 07, 2009


So, today I'm working on a new industrial input card for our logger family. Lots of 0..20mA inputs and some switched outputs, usual sort of stuff.

For added interest it has two AVR processors. A Mega128 sitting down near ground doing most of the work (handling the comms, multplexing inputs, driving the ADC and so on) and a Mega8 sitting up near the supply positive rail watching the current drawn on the outputs and turning them off if the current exceeds preset limits. These two talk to each other through a level shifting serial link.

Doing it with two processors is both the cheapest and neatest solution to the problem, the alternative would be to have lots of level shifting hardware for the various outputs and current sensing lines, which would involve much more hardware and be less accurate with it.

But - there had to be a but - it does mean that I have to simultaneously develop software for two processors that are running at different grounds, and also one of them needs a software emulated serial port because the hardware ones are busy doing other comms jobs, hence there is some slightly awkward software and the programming requires isolated AVR programming/debugging interfaces. Well, I have those, so no problem.

Hah. The gods don't like cunning designs.

I blow the first Mega8 up when the bloody ground clip of a 'scope probe unclips itself and wanders across the PCB, managing to touch one of the AVR I/O pins. Normally this wouldn't be a problem, but it picks the AVR that has its ground up at +20V or so. It doesn't like having one of its pins dragged down to -20V (as it sees things) so bye-bye and off to silicon heaven it goes.

Much gallic muttering ensues as Herve replaces it.

A few hours later I'm busy working on the serial comms between the two processors when the 'scope probe slips out of my hand. It misses the board and I have a moment of relief until I realise it's heading for the exposed PCB of the isolated AVR programmer... It lands on it and there is a very slight, but clearly audible, click as the earthed shield of the probe makes contact with some component or other on the programmer.

Of course, it doesn't do this with the programmer that's sitting at ground, it picked the programmer that was connected to the positive rail and which was sitting with its ground at +20V or so, and that click signifies the end of that particular programmer. And, of course, the end of the bloody AVR it was connected to as well.

This happened at 10:30 pm, and at about 11:30 pm there was even more gallic muttering as Herve (dragged back into work) replaced the Mega8 again. This was accompanied by a fair bit of my own muttering as I repaired the AVR programmer.

About an hour and a half later the other AVR, which had been sitting down at ground and minding its own business, stopped talking to the debugger. After a bit of investigation it turned out that one of its I/O pins was damaged at some point in the preceeding fiasco and had quietly rotted.

Think I'll wait 'till tomorrow before I tell Herve he's got to replace the Mega128 now.

I'm starting to think the gods really don't like this design...


  1. Strange isn't it. I know about most of these "incidents" in near real time and I still buy this stuff.

    Mind you, it does work by the time I get it.

  2. Someone has too buy it. Thing how nasty it would become if it spent any longer here before it was weaned...

  3. What the hell just happened to my English? Too? Thing?

    It's working with modems... Not that anything ever does.