Well that wasn’t easy.
Finally, the SmartParallel TTL serial to parallel printer interface has a complete PCB layout. And I learned a few lessons along the way.
The most important of these, perhaps, is that when assigning signals to the pins of a microcontroller during the schematic drawing part of the project, don’t rely on whimsy or the luck of the draw.
Schematic symbols often bear no relation to the physical layout of the component. And this can be a good thing. A component might be available in a variety of packages, with different pinouts. However, the arbitrariness of symbols can cause big headaches when it comes to laying tracks on the PCB.
And so it was with the ATMEGA328PB I’m using on the SmartParallel board. The square TQFP-32 package has eight pins on each of its four sides. While some pins have defined functions (TX, RX, SDA, SCL etc) which predetermined some of the connections, many others were entirely arbitrary. And so, on the schematic, I tended to group signals with related functions on single ports.
But when it came to hooking up the ATMEGA328PB with the other ICs and connectors, this random arrangement turned out to be sub-optimal.
In the end, I wound up changing many of the pin assignments. I had the schematic and the PCB layout open on screen side-by-side to help me relate each pin number to the physical pin on the chip and where the connection from that pin needed to go.
Luckily, KiCad 5 has made great strides when it comes to updating a PCB layout after having made schematic changes. This is a one-button operation now – so much better than the old, tedious process of re-exporting and re-importing netlists.
I may end up having to do a little more work in the software with these new pin assignments. But I’ll worry about that later.
Some of the routing on this design is somewhat, shall we say, idiosyncratic. I used more vias that I would have liked, with a few tracks jumping back and forth between the top and bottom layers like an amphetamine-crazed snake.
What are the chances this board will work first time? Doesn’t seem likely, does it?
Back to the breadboard
Although the first version of the board is done, I’m not going to rush to get it fabbed. First, I want to replicate the design on a breadboard and see if that works. I’ve already tried a breadboard prototype, but I’ve made a few changes – such as which lines have pullup resistors – since then.
One other change I made was to rotate the serial port connector (a row of six pins) 180 degrees. Again, this was just to make running tracks easier. It did have one other implication, though. The 5V-to-3V3 TTL level shifter board I’d previously designed would have to be used upside-down now.
I did briefly toy with the other idea of including switches and resistor dividers to make the voltage levels on the serial port switchable between 5V and 3.3V. In the end, I decided this was too much bother, and so stuck to 5V and relegated the job of shifting levels to an add-on board that can be plugged in when needed. But the idea of having to have this board upside down, and thus not see its blinkenlights, was just too much. So I’ve redesigned that, too. I’ll post about that separately.
• The GitHub repo for this project is here: https://github.com/mspeculatrix/SmartParallel.