Category: Design tools and apps

Soldering is a skill lots of hobbyists learn out of necessity, but for most people this limits you to working with through-hole parts which were state of the art in the 70’s and 80’s. These days, anything electronic actually being professionally designed for production is using surface-mounted parts, with the solder applied using a silkscreen-style stencil, the parts robotically placed on the paste pads, and then the whole thing goes through a reflow oven to melt the paste and voila, the whole board’s done at once.

Things get tricky when you discover a design flaw during the development process and you want to rework the board to test potential fixes before committing to a new manufacturing run. Today, I had to move a few resistors to alternate locations on a board we’re designing at work. The resistors are there to configure a chip with certain “hard-coded” settings at boot time. They’re also incredibly small- SMT resistors of the 0402 variety- this means each one is .4 x .2 mm in size. That’s really, really small. Reworking parts like this evidently usually involves specialized tools like special hot-air soldering tools to heat multiple leads simultaneously, or irons with very fine pick-like points, and a binocular microscope is really the only way to see what the heck you’re doing. Luckily the lab does have most of these.

I was the only one in the lab today and this was really at the edge of my skills. There did not appear to be an SMT desoldering tweezers, available, so I tried using a very small hot air nozzle to heat up the leads. I tried higher and higher heat and air volume settings, but for some reason I just could not get the solder to reflow. I still haven’t figured out why. I then resorted to a standard iron with an extremely fine point. This melted the existing solder easily, but it was impossible to nudge the resistor off its pads without damaging one or the other of the extremely fine leads which wrap around the sides, to the bottom where they meet the pads. I’ve been able to do this with larger smt parts, but these are just too delicate. Luckily there was a tape reel available with additional resistors of the correct value and size, so I opted to just dispense with the damaged ones and use new resistors on the correct locations. Manipulating them into the correct location and orientation and then getting a good solder joint on both sides was a challenge as well, but ultimately I think pulled it off successfully.

This took quite a bit of time, and it made me wonder just where do the professional lab techs who do this kind of rework learn these skills? I sometimes see some very nicely done “blue wire” jobs with a tiny little 30- or 32-gauge wire neatly creating a new trace, and I just don’t know how these guys do it, or where they learned how in the first place. I’d love to raise my game.

Got to debug a few fun board bringup problems at work recently, and even have been writing a pile of code for the project in VHDL, and Labview FPGA. One involved an HDMI receiver chip that wasn’t putting out stable hsync pulses, there were periodic weird glitches that would cause the downstream logic to get confused about how many lines were in the frame. The solution turned out to be adding an obscure and almost undocumented set of reset commands to its initialization sequence. Send the magic incantation to the chip and voila, clean signal. Took days to find that one. Someone ought to tell Silicon Image that stuff like that should be at the front of the programmers’s ref in big bold type, not buried at the end in obscure language.

The next one was finding a fun off-by-one error in a VHDL CRC calculator. Pipeline delay was causing the calculation to start and end one value too late at its input stream. Had to use Isim to prove that what we were producing was a wrong value, and validate the fix.

It’s fun playing Developer for a while, but I also remember now why I went into program management. Debugging drives me berserk some days. About a week ago it took me nearly an entire day to find a tiny missing line segment in a Labview diagram that would’ve been an instant compiler warning in pretty much any other language… But find it I did, much to my blood pressure’s relief.

After a few more pokes and prods, I did finally get some response from Digilent tech support, but they pointed out to me something I should’ve tried up front.  In short, the Flash chip needs to be sent a reset command, and then it acts like a normal ROM just fine.  I figured since the chip is reset as part of the powerup sequence anyway that it shouldn’t be necessary, but that was clearly a faulty assumption.  One line of code at the front of the app makes it all work well.

Well, anyway, once I had the bootloader working and solved a few more Duh problems with running my app out of the PSRAM, I think I finally found the one issue that puts the bullet in the head of running this project on a Microblaze – memory bandwidth.  The PSRAM asynchronous mode gets you a 70ns access time.  It can be sped up if you can put the chip into fully synchronous mode, but I believe that’s not currently supported by the Digilent memory multiplexer.  With 70ns access, the Microblaze pipeline is effectively perpetually starved by the lack of memory access bandwidth, and simply clearing the 16×32 display with a nice tight C routine takes over a millisecond. Trying to maintain a 60hz framerate with the memory heavy frame buffer manipulations required to scroll the text and shift colors would probably be pretty difficult.

I even looked into the possibility of attaching a faster DRAM to the VHDCI connector and using the onboard memory controller on the Spartan-6, but unfortunately the layout of the Nexys-3 board makes that impossible, the required pins aren’t wired up to that connector.  You’d need the next board up the lineup, the Atlys, which includes the DRAM onboard already.  So, I think it’s back to Picoblaze and assembly programming.

Things were wrapping up on the radio clock just as we were heading into the holiday season back in 2010, and my wife bought me a bunch of nice little projects – this little scrolling message board from Hansen Hobbies was in my stocking:

This took all of about 15 minutes to put together, but it’s cute and it works well.  In hindsight, the $40 pricetag is a little large, and for what it is (a small toy), I think they’re just a tad overprotective of their source code (i.e. they explicitly say on their website that they won’t give it out.) Oh well.  Anyway, as soon as I had it working I realized two things:  One, I wanted COLOR! And two, gosh, it’d make a nice clock… so now I had my next project in mind.

The basic architecture was pretty easy to understand, you just need to daisy-chain a bunch of 74xx595 shift registers together and each bit lights up a single pixel, and then you scan through the rows rapidly enough (i.e. 60hz or greater per frame, or > 480 lines per second) to create the whole character using persistence of vision, just like an old CRT TV.  The first trick was finding RGB color 8×8 matrixes like Hansen’s little red ones, though.  The standard sources (Digikey, Mouser, etc.) simply do not have any of these, primarily because it appears that there aren’t any Large Reputable Electronics Manufacturers building these.  Well, maybe Lumex is, but the distributors don’t stock them, and they also don’t sell them onesy-twosy.  However, there are Chinese companies churning these out like there’s no tomorrow.  I did find some available at Sparkfun, and I also later discovered you can buy them from the nice folks at EvilMadScientist too.  (I still want an Eggbot.)  They’re kinda pricey, though – Sparkfun’s go for around $30 each, if I remember correctly, and I wanted to daisy chain at least three of them together to have enough real estate to be able to read a message.  I didn’t really have much choice, though, other than to abandon the project altogether.

I started really simple and bought a single tri-color LED at Radio Shack.  This let me experiment with writing some PWM (“pulse width modulation) code to fade the colors on a single LED.  For the non-engineers: PWM just blinks the light on and off at varying durations, but at very high speed, so that it appears to be different brightnesses as desired, but not flickery to the human eye.  It was very pretty, I still want to go back and build a little mood lamp out of it. Having knocked that together quickly, my idea was that I would design my own printed circuit board for the first time and I’d design it with connectors so that you could chain an arbitrary number of them together and build it up to be as big as you want.  3 seemed like a good place to start.

It seemed natural to use another Propeller as the microcontroller, since I’d just invested a whole bunch of time learning how to use it, so I attached another RTC chip to drive the clock to a Propeller and then it was time to design the basic circuit. Here’s a pic of the breadboard:  It was quite a tangle, because a single 8×8 RGB display has 32 pins, 8 transistors to sink a row of LED current through, each with a base current limiting resistor, and 24 resistors to limit the current to each column, and 4 shift register chips.

The messy breadboard

It did the job though – it was invaluable to get some software running, lighting up different dots and colors, and scanning through the rows.

Confident that the circuit was working well, it was time to develop a New Big Skill that I had no experience with, namely, PCB design. I spent about 10 minutes looking at Eagle’s UI and just about retched up a lung.  I mean, seriously, it’s not 1995 any more. With this many years of graphical app design in the world, you’d think they would have done a major overhaul by now just for usability’s sake. In researching the alternatives, I found Diptrace and I haven’t looked back since.  You can download a 300-pin 2-layer version as freeware, and they will provide you with a 500-pin update for non-profit use for free, just by asking.  The Diptrace UI follows standard Windows conventions fairly well, the tutorial was good enough to get me off the ground, and the product is of reasonably high quality. I haven’t found any obvious bugs. The word on the street is that their “shape” autorouter, which figures out how to route the wires on the board without overlapping other ones, blows Eagle’s out of the water.  My experience to date is that the router does an excellent job, although it does suffer a little bit from poorly documented parameters.  You can usually improve a bit on the routing it comes up with after the fact, but I’ve seen it solve some pretty tough situations, and it makes for a good starting position for minor manual tweaks.

Here’s the final revision I designed around the Sparkfun LED module:

OK, it took me about 3 or 4 iterations to get there (and a lot of roundtrips with Sparkfun’s BatchPCB service.), so it was costing me a fair bundle to get “final” boards, but by gum, I was learning! It’s educational, right? 🙂 The revisions allowed me to include a few things I’d forgotten like room for mounting holes, and also to make a reversal of which side was input vs. output on the ribbon cable connectors.

A shoutout to BatchPCB here, by the way: Most printed circuit board companies, of which there are many, are built around a business model where volume discounts can be extremely steep but low volume orders are expensive.  There’s a lot of setup and prep involved with making the first board of any particular design, so it’s hard to drive down those manufacturing costs.  Where BatchPCB comes in is to aggregate lots of hobbyist single-order boards onto one larger panel, and to work with a Chinese company to get the boards produced at lower cost.  The turnaround time is long (typically around 3 weeks from order to receipt of the goods) but the cost savings is worth it.  Furthermore, you virtually always get at least one more board than you actually paid for in “overage”, which is a real bonus.

There is an alternative in Oregon that I like too (Sunstone Circuits) who also has a reasonably cheap 2-layer prototyping service with 2-week turnaround (and usually even less, in my experience).  They’ll only silkscreen one side of the board compared to both sides for BatchPCB, but on the positive side, Sunstone’s minimum trace/separations for 2-layer boards are slightly smaller at .007″ vs. .008″, and they can do smaller vias as well (.016″ vs .020″).  Also, from up here in Seattle even ground shipping amounts to overnight service, so even though the price is a bit more, sometimes it’s worth it to keep from getting stalled on a project.

Routing the traces for this board as my very first PCB project was a little tricky because of a few conflicting constraints:

  1. The board needed to be the width of the LED module so you could put them next to each other and get a seamless transition from one module to the next in line.
  2. The LED chews up a pile of board area, and I wasn’t comfortable yet with surface mount parts, so everything had to be through-hole.  This meant mounting shift registers and DIP resistor packs on the back of the module under the LED to make use of all that board space.  Once the LED is soldered on, you won’t be able to make any changes to the parts soldered underneath it.  (On assembly, I realized this also meant screwing down the board standoffs (good and tight!) before soldering on the LED as well.
  3. Traces were getting a little bit tight side by side, particularly since I wanted to be a bit conservative for traces carrying a lot of current back to ground.

It did all fit in the end, though, and I was pretty pumped when my first boards of my first design worked great, right out of the gate.  That was a really fun day. 🙂 Some others that I’ve made since then have not been so lucky – it’s a real drag when you think you’ve triple checked the layout and the schematic and you STILL find some error that’s a pain to fix when they come back in the mail.

Next time I’ll throw in some pictures of the final result and talk some more about the software that drives this RGB panel, because that’s a whole saga of its own.


%d bloggers like this: