Wednesday 4 June 2014

Breakout board for 64-pin QFN/QFP mcus like ATMega128 and ATMega165

Having got the ATMega165 and struggled to get it working with the Arduino IDE, we gave up and bought the ATMega128 and a dedicated programmer for it (not the USBTiny from Adafruit).

We've already designed our board game section(s) numerous times, using different 64-pin chips, in different pin pitches and with different pin assignments. And just when we thought we'd got it sorted, we found that the pins we'd broken out to an ICSP programming header simply wouldn't work with the ATMega128 (because that uses the PDI/PDO pins, not the MOSI/MISO pins for programming)

Before we actually commit chip to board, we thought it best to actually test the pinout for the ATMega chips we have here, so tonight quickly knocked up a breakout board for testing. In the building of this breakout board, we changed a few techniques for hand-soldering surface-mount parts.


Above is the PDF of the breakout board - as ever, if making one of these yourself, print at 100% (or actual size). Because we used the laser-etching method of creating our etch mask, the pdf isn't mirrored - however, because all we're doing it putting pins to edge connections, it doesn't matter a jot!


When hand-drilling 64 holes on a board, using a Dremel with a 0.8mm (extremely brittle) carbide bit, without a press or pillar drill, it's only a matter of time before one or more bits snap! Amazingly, we only broke one drill bit, drilling three breakout boards, each with 64 pins on: that's nearly 200 holes and only one drill bit snapped!

With the board drilled and the pads coated with rosin/flux, a quick snail-trail of solder paste is all that's needed. Unlike other smt boards, where we try to place the solder paste under the leg of the component being fixed down, we put the solder paste along the furthest edges of the component pads.


The reason for this is because our chips are quite large - certainly too large to hold in our little tweezers, so we're going to have to be a little bit ingenious with our placement here:


As we don't have a vacuum pen handy, the next best thing is a blob of blue tack (or, white-tack from the pound shop) which allows us to lift the entire chip in one go. The reason for placing the solder paste so far away from the legs is because any tiny movement from the chip, and the solder paste could get smeared about under the legs. Normally we don't worry too much about this kind of thing - just add plenty of flux and apply some heat and the excess burns away, leaving nice clean joints.

But because our traces for this chip are so fine (0.3mm) there's not much holding the copper to the board - we don't want to be exposing these tiny traces to too much heat for any longer than necessary.

By placing the solder paste around the outside of the legs (rather than under them) we're able to nudge the chip around on the board, until all four sides are perfectly aligned, and all 64 legs are sitting exactly on top of the centre of a pad beneath them.

With the chip held down and correctly aligned, simply solder one side of the chip - using the iron to firstly push the solder paste up the trace and onto the leg, then raking out any excess solder that may gather between the legs (breaking any bridges between the legs, as we normally do with our SMT soldering technique).


After repeating this process for all sides, we then tested every pin on the chip for continuity to the pad on the edge of the board. In our case, all the joins were good - there were no shorts between legs, and no broken traces or bad solder joints. Phew!


Next we need to solder on some pin header sockets, so that we can poke some wires in and connect the chip up to a breadboard (in much the same way people use an Arduino and a breadboard for simple prototyping).

Soldering 64 pins by hand can be a tedious job, and there's always one or two holes that are slightly off-centre (or, worse still, so badly placed as to break the trace from the pad). We had a couple of these on our board, but a technique in mind to fix them!

When soldering the pin headers onto the underside of the board, we made sure that iron was always on the inside of the board, with the solder being applied from off the board:

(right-handers will have the iron on the right, and solder coming in from the left, but with the board also to the left, or "underneath" the iron)

The idea behind this approach is that after applying the solder to the joint, if the trace is broken from the surrounding ring, it's possible to bridge the broken gap by simply dragging the iron from the outside of the board, following the trace, towards the chip in the middle. If there is a break in the trace, or the pad doesn't quite meet the trace, because of a badly placed hole, this technique almost always reconnects the pad back to the trace.

Here's the final breakout board, all soldered up


And on the underside, the rows of pin header sockets, ready to accept some solid-core wires to connect up to a breadboard, ready for prototyping.


On the underside of our board we marked where pin one starts, and the direction of numbering (when looking at a surface mount part from the underside, the numbering goes clockwise from the top right, rather than the usual anti-clockwise from top-left.

Soldering the AtMega128 onto our breakout board was actually a lot less difficult than we'd anticipated. In fact, so bouyed were we by the apparent success of this breakout board, that we put an ATMega165 onto another board, to give to Steve next time we meet - he's spent so long working on the Arduino IDE to get it, and the USBTiny programmer, working (after we gave up on hitting the first hurdle) it'd be a shame if he didn't get to try it all out!


Until then, we've an ATMega128 on a breakout board, ready to try to dump some code to, in the morning. Assuming we've got the pinout correct, for the external crystal and the programming pins, we'll be able to etch some more (hopefully final-design) board game sections and mount the ATMega128 chips onto them, for testing. 

It was tempting to just go for it and stick these chips straight onto the newly-designed board game pieces. But if there was a problem, we'd be none the wiser: at least taking an extra evening to build a breakout board, we'll be able to keep swapping pins and wires to get something working - something we couldn't do if we just went straight to pcb from here (however tempting that has been over the last couple of days!)


No comments:

Post a Comment