This is only a preview of the October 2024 issue of Practical Electronics. You can view 0 of the 80 pages in the full issue. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
Constructional Project
How to program SMD microcontrollers with
TQFP Programming
Adaptors
Our new PIC Programming Adaptor, described last month, can program
many chips in DIP, SOIC, MSOP, SSOP and TSSOP packages. But SMD
micros come in other packages, including SOT-23-6 and QFPs (quad
flat packs). This article explains how to program such devices
out-of-circuit with several reconfigurable programming jigs.
By Nicholas Vinen
T
hese jigs are inexpensive and
straightforward to make. Still,
they are invaluable if you need to
program SOT-23-6 or QFP microcontrollers before being soldered to a
board, such as when the board lacks
a programming header. They aren’t
limited to PICs; they will work with
most microcontrollers in these packages, including AVRs and many ARMbased types.
We use jigs like these all the time
to program chips we sell, including
the ones below:
● The 64-pin PIC32MX470F
512H-120/PT programmed for the
Micromite Plus (Explore 64).
● The 100-pin PIC32MX470F
512L-120/PF, also for the Micromite
Plus (Explore 100).
● The 44-pin PIC16F18877-E/PT
for our recent Wideband Fuel Mixture Display (WFMD).
● The 32-pin ATSAML10E16A-AUT
for the High-Current Battery Balancer.
Those are all QFP chips but with
different numbers of pins, so a separate jig is needed for each one. Note
that sometimes QFP chips with the
same number of pins can be different
sizes, so you may need more than one
jig with the same pin count. However, as our jigs are reconfigurable, you
only need one of each, even if you
need to program different chip types
in that package.
Most QFP micros actually come in
either TQFP (“T” stands for “thin”) or
LQFP (“low-profile”) packages. The
sockets we’re specifying suit TQFP,
although other types may be available.
Let’s go through the jigs individually, from the fewest pins to the most.
SOT-23-6
This suits tiny PICs like the PIC10(L)
F202-I/OT or PIC10(L)F322-I/OT that
we used in our Remote Control Range
Extender (January 2023).
These often need to be programmed
out-of-circuit because they’re typically used on very small PCBs that
probably don’t have much room for
a programming header.
This is the simplest jig as it is just
made of a commercial SMD to DIP
adaptor (AliExpress pemag.au/link/
abmu) plus five female-to-male jumper
leads. It is shown in Photo 1, and the
wiring is shown in Fig.1.
Fig.1: here’s how to wire a PICkit 4 to an SOT-23 programming socket via
jumper wires. It might not look ‘kosher’ but we’ve found it works fine,
even without local supply bypassing for the PIC being programmed.
Photo 1: the SOT-23-6 ‘test socket’ can be wired to a PICkit 4 using five
male-female jumper leads. Then tape or glue them together where they
go into the PICkit. This work fine despite the lack of bypass caps (the
software verifies the programming so it would catch any errors).
28
Practical Electronics | October | 2024
SMD Programming Adaptors
Fig.2: our four TQFP programming adaptors all follow this basic configuration, designed for maximum flexibility. The
headers around the socket make it easy to connect any pin to GND, Vcc, Vdd or one of the pins on the programming
header (CON35/CON36) via jumper wires. The optional regulators at the top can derive two different Vdd & Vcc supply
rails from an external DC source.
Practical Electronics | October | 2024
29
Constructional Project
While there are no bypass capacitors
or anything like that, we’ve found it
works fine as long as the jumper leads
are kept short.
If you come across a different micro
in the same package that uses a different pinout, rearranging the jumper
wires to suit will be simple.
The socket is pretty expensive at
about £30, including delivery, but
it works well, and there aren’t many
better options.
If you only need to use it occasionally, a cheaper option is to design a PCB
with an SOT-23-6 footprint wired to
a programming header. Then, instead
of soldering the chip to its footprint,
simply hold it in place with a clothes
peg or similar. That can work surprisingly well, but it’s fiddly. We would
only do that for the occasional chip;
we wouldn’t want to program dozens
that way.
TQFP-32, -44, -48 & -64
We have two options for TQFP package chips. The first is the simplest but
only suits chips like the ATmega328P.
They are so common that you can get
an adaptor that converts the pinout to
the through-hole (DIP-28) equivalent.
For example, this one costs £10, including delivery, at the time of writing: pemag.au/link/abmv
Fig.3: how the
32-pin TQFP
programming
adaptor rig
would look if
you fit all the
components.
That would
give you all the
options you need
for programming
any chip in this
package, but in
most cases, you
can save yourself
a bit of time and
a few dollars
by only adding
the components
you need for
programming a
given micro.
Fig.4: this shows
how we built a
very minimal
programmer
for the
ATSAML10E16AAUT ARM-based
microcontroller
from Atmel (now
Microchip) on
the same PCB
shown in Fig.3.
That chip is
programmed
using the AVR
SWD (serial
wire debugging)
protocol,
which uses
different pins
on the PICkit
4 8-pin header
compared to PIC
programming.
30
Say you have a means of programming a DIP ATmega328P, such as a
TL866II or the newer T48 universal
programmer. In that case, you just need
to purchase the SMD adaptor, slot it
into that programmer and away you
go – see Photo 2.
A more flexible option that also
works with chips like the ARM-based
ATSAML10E16A mentioned above is
our custom adaptor board that accepts
a commercial TQFP programming/test
socket. Its circuit is shown in Fig.2 and
the matching PCB overlay in Fig.3.
There are relatively few components
on it, so it’s pretty easy and inexpensive to build.
Our larger 44-pin, 48-pin and 64-pin
adaptors follow the same pattern, so
the following description will cover
all of those. PCBs for all four versions
are available from the S ilicon C hip
Online Shop.
The test sockets are well made, have
gold-plated contacts for a long life and
only cost about £8-13 each. We have
links to each one we’ve tested in the
parts list. They have a staggered pin
pattern unsuitable for use with protoboard and such, hence our custom
PCB designs. Each PCB suits a specific socket.
Surrounding that socket, we have
six rows of headers with one pin for
each socket pin. The three closest to
the socket allow you to use a jumper
to connect that pin to GND or one of
two power supply rails. You can also
plug in a female header upside-down
that lets you connect a capacitor from
that pin to GND, or a capacitor to GND
plus a connection to the supply rail.
For pins used for programming,
it’s a simple matter of fitting a short
female-female jumper lead between the
pin in the middle row and one of the
ICSP header pins. Two sets of headers
are provided to make it easy to connect these pins to an ICSP dongle like
a PICkit or Snap programmer (PICkits
can program AVRs now too).
The second set of three headers
allows you to choose, for those pins
connected to a power rail, which power
rail that is. That is done by placing a
jumper between the centre pin and
either the Vcc or Vdd row. Note that
most micros don’t need two rails for
programming, so you can use Vdd exclusively for those, but we wanted to
provide maximum flexibility.
Each set of Vcc and Vdd pins along
each side of the chip has a pair of
Practical Electronics | October | 2024
SMD Programming Adaptors
Photo 2: this socket comes pre-mounted on a small PCB with a pair of SIL
headers on the underside. They are routed to match up the pinout of the
TQFP-32 version of the ATmega328 (and similar chips) to the DIP-28 version,
so a standard DIP programer can be
◀ used to program the TQFP chips.
bypass capacitors to GND. This means
you can get away without needing to
add bypass capacitors closer to the
chip in most cases; you can simply
use jumpers to connect GND and Vdd
where required.
Two adjustable or fixed linear regulators can be mounted in the board’s
upper left and upper right corners
to supply either the Vcc or Vdd rail.
In most cases, we use a PICkit to deliver power to Vdd via its header and
don’t bother with these. But again,
this gives you flexibility. Using these
regulators, you could derive Vcc and/
or Vdd from USB 5V, a plugpack or a
bench supply.
Pads are also provided to fit SMD
LEDs to show when the Vcc and Vdd
rails are powered.
Finally, there are rows of pairs of
uncommitted pins that you can use
for jumpering signals if required. The
only connections on the board are between the pairs of pins.
Fig.4 shows the minimal parts
needed to configure this board for
programming the ATSAML10E16A,
while Photo 3 shows our actual jig.
That demonstrates that you only need
to fit the parts you need for a particular application, and you can add more
Practical Electronics | October | 2024
later if necessary. Here, we’re using the
PICkit 4 in its CORTEX SWD mode (it
also supports AVR ISP, among other
protocols).
One thing to note about these jigs
is that the space around the socket is
tight. That’s because we’ve broken out
the pins close to it, keeping the track
lengths as short as possible. It’s a little
squashed, but we’ve programmed hun-
◀
Photo 3: a minimalist assembly of the 32-pin TQFP adaptor set up for the chip stated on the
label. Labelling the adaptors so you can remember what chips they are set up for is a good idea.
dreds (if not thousands) of chips with
these jigs and haven’t had any real difficulty getting them in or out.
However, that could be a good reason
to avoid fitting parts you don’t think
you’ll need.
There are mounting holes in the
corners for tapped spacers, so the jig
sits flat on a bench. That makes them
much easier to work with.
Fig.5: here’s
where all the
components
go on the
44-pin TQFP
programming
adaptor.
This package
is pretty
common for
8-bit PICs (eg,
PIC16F18857
and
PIC16F18877),
16-bit PICs
(eg, dsPIC33FJ128GP804),
32-bit PICs
(eg, PIC32MX170F256D-I/PT)
and AVRs (eg,
ATmega644PA).
31
Constructional Project
Fig.6: this shows
how we wired up
our assembled
44-pin TQFP
programming
jig to suit
PIC16F18877-I/
PT chips.
Target power
is delivered by
the PICkit. The
programming
connections go
via the pins on
the “Pwr” row
and then via
jumpers to the
IC pins to keep
them away from
the front socket
opening.
Fig.7: here’s
where the
components
go for the
48-pin TQFP
Programming
Adaptor. We
have the parts
to build one but
haven’t done
so yet because
micros in this
package are far
less common
than either 44
pins or 64 pins.
We have placed a large filled circle
on the PCB silkscreen at the upper-left
corner of each TQFP socket to indicate
where pin 1 of the IC would typically
go. You then line up the dot or divot
on the chip with that marking.
All that means is that the pin number
labelling on the headers will be correct
when the chip is orientated like that.
You could use a different orientation
and reroute the connections to suit if
you wanted to, as there are no fixed
connections to the socket on the board.
Still, keeping pin 1 in the upper lefthand corner is less confusing.
32
TQFP-44 programming rig
We haven’t drawn the circuit for
this one as it’s the same as Fig.2 but
expanded for the extra pins. The PCB
overlay is shown in Fig.5. Photo 4
shows our jig, currently configured
for the PIC16F18877-I/PT, while Fig.6
shows that wiring. Other chips we’ve
programmed with this rig include the
PIC32MX170F256D-I/PT and ATmega644PA.
Note in Photo 4 how we’ve plugged a
3-pin socket into the header for pin 28
(Vdd) with a capacitor soldered across
one pair of pins and a short wire across
Photo 5: the
64-pin TQFP
Adaptor board
set up for a
PIC32MX470. If
you don’t
need to make
connections to
the pins on the top row of the
socket, especially in the middle, it
can pay to leave those headers off,
as it might allow you to open the
socket clamshell wider, making it
easier to get chips in and out.
the others. It acts as a jumper to connect Vdd to that pin while providing a
bypass capacitor to GND.
TQFP-48 programming rig
Again, the circuit is the same as Fig.2
but with extra pins on the socket, while
the PCB overlay is shown in Fig.7.
We haven’t built one yet as we don’t
need it. That’s because most microcontrollers in 48-pin TQFP packages
are ARM-based types that we haven’t
used (from Infineon, Renesas or Silicon Labs).
Still, we designed the board and
Practical Electronics | October | 2024
SMD Programming Adaptors
Photo 4: here, we have installed
all the headers around the
44-pin TQFP socket to make
the Adaptor more flexible.
Note the addition of a bypass
cap on one of the supply
pins using an upside-down
three-pin socket. A closeup of the ‘jumper’ made
out of a 3-pin socket and
capacitor we had to
make is shown below.
Fig.8: this is the
64-pin version
of the TQFP
Programming
Adaptor. It’s
a reasonably
common
package,
especially
for 32-bit PIC
microcontrollers
and some
PIC16s, PIC18s,
PIC24s,
dsPIC33s, Atmel
ATSAM chips
and more. This
is basically the
same as the other
boards but with
more socket and
header pins.
Fig.9: the 64-pin
Programming
Adaptor set up
for the PIC32MX470F512H-120/
PT used in the
Micromite Plus.
We removed
the plastic from
some headers
for pins 53-55
and 58-60 so
they would sit
lower and give
more clearance
for the TQFP
socket hinges.
They’re still long
enough to fit
jumpers.
sourced a socket, so we decided to
make the PCB available to anyone who
might need it.
TQFP-64 programming rig
Again, this circuit is simply that of
Fig.2 but with twice as many socket
pins and associated header pins.
The PCB overlay is shown in Fig.8,
with Fig.9 being the minimal configuration for programming a PIC32MX470F512H-120/PT or similar (this
should also suit 64-pin dsPICs). Photo
5 shows our jig for programming the
PIC32MX470F512H-120/PT.
Practical Electronics | October | 2024
We also built a TQFP-64 programming jig for the powerful PIC32MZ2048EFH064-I/PT chip that Phil
Prosser likes to use in his projects. As
shown in Photo 6, we didn’t use our
custom board for this but instead purchased a socket that came on a PCB
with 16-pin headers on all four sides
(on the underside).
We then mounted that on a protoboard via four 16-pin sockets and
soldered the bypass capacitors and
programming header to that. Connecting the pins to GND, Vdd and the programmer pins was done by point-to-
point wiring using Kynar (wire wrap
wire), which is thin but stiff and easy
to work with.
We could have used the custom
jig in this role, but we wanted to try
a different approach. It was a little
work to do this but it worked fine.
At the time of writing, this adaptor
costs £16, including delivery and can
be purchased from pemag.au/link/
abmw
TQFP-100 programming rig
We haven’t bothered to make a
custom 100-pin board for several
33
Constructional Project
Photo 6: as an alternative approach, this 64-pin TQFP socket
was purchased already fitted to a board with headers on
the underside. We then soldered matching sockets on a
piece of protoboard and hardwired a programmer for
the PIC32MZ. It’s a bit less flexible than the other
approach, but it works.
Photo 7: this hand-made 100-pin TQFP
programming adaptor has served us well,
programming all the PIC32MX470
chips for the Explore 100. The added
protoboards (joined by two wires
across the back, for Vdd & GND) can be
unplugged as they are on sockets that fit the
pre-existing headers.
Parts List – TQFP Programming Adaptors
Parts required for all versions
1 6- or 8-pin header, 2.54mm pitch
1 6- or 8-pin right-angle header, 2.54mm pitch
16 M2012/0805 100nF 50V X7R ceramic capacitors
10 small jumper shunts
3 short female-female jumper wires
4 M3 tapped spacers
8 M3 × 6mm panhead machine screws
4 M3 hex nuts
1 serial programmer to suit chip(s) being programmed
TQFP-32 programming adaptor
1 double-sided PCB coded 24108231, 95 × 82.5mm
1 TQFP-32 ‘clamshell’ test/programming socket [pemag.au/link/abmy]
24 8-pin headers, 2.54mm pitch
TQFP-44 programming adaptor
1 double-sided PCB coded 24108232, 95 × 82.5mm
1 TQFP-44 ‘clamshell’ test/programming socket [pemag.au/link/abmz]
24 11-pin headers, 2.54mm pitch
TQFP-48 programming adaptor
1 double-sided PCB coded 24108233, 95 × 82.5mm
1 TQFP-48 clamshell test/programming socket [pemag.au/link/abn0]
24 12-pin headers, 2.54mm pitch
TQFP-64 programming adaptor
1 double-sided PCB coded 24108234, 95 × 82.5mm
1 TQFP-64 test/programming socket [pemag.au/link/abn1]
24 16-pin headers, 2.54mm pitch
Optional parts for all boards
1 or 2 M3216/1206 SMD LEDs plus 1kW M2012 resistors (for VDD/VCC indication)
1 two-pin female header plus M2012/0805 22μF 6.3V X5R capacitor
(for micro pins that need a capacitor to GND)
1+ three-pin female header plus M2012/0805 100nF 50V X7R capacitor
(for micro pins that need local bypassing)
1 2×8 pin DIL header, 2.54mm pitch (for extra GND terminals)
2 2×20pin DIL header, 2.54mm pitch (for extra connecting terminals)
Extra parts per onboard regulator (up to two regulators per board)
1 LP2951D adjustable linear regulator, SOIC-8 (REG1/REG2)
1 50kW top-adjust multi-turn trimpot (VR1/VR2)
1 27kW 1% M3216/1206 or M2012/0805 SMD resistor
2 4.7μF 25V X5R M2012/0805 SMD ceramic capacitors
1 10nF 50V X7R M2012/0805 SMD ceramic capacitor
1 4-pin header, 2.54mm pitch
1 3-pin header, 2.54mm pitch
1 jumper shunt
34
reasons. The main one is that we have
programmed only one 100-pin micro
to date, the PIC32MX470F512L-120/
PF used for the Micromite Plus Explore 100. So we only needed a simple
fixed jig.
We were able to buy a 100-pin socket
pre-mounted on a PCB with two pairs
of 50-pin DIL headers. It was relatively easy to solder strips of protoboard
to these headers and then use that to
add bypass capacitors, a programming
header and the connections necessary
for programming, as shown in Photo 7.
It’s a little dusty, but it works!
As with the PIC32MZ rig, the protoboard is attached via sockets, so we
could theoretically unplug them and
change the socket to work for a different micro if we need to. Note the
two wires running across the back of
the socket that join Vdd and GND between the two sides. The programming
header is on the underside of the lefthand board and is just visible in the
photo. The point-to-point wiring was
done using Kynar wire-wrap wire, as
it’s easy to work with.
This adaptor costs £26, including delivery at the time of writing, and can be
purchased from pemag.au/link/abmx
Conclusion
These programming rigs are somewhat specialised, but they certainly
come in handy when you need them.
You might build one when embarking
on a project that uses a particular chip,
and you could build up a collection
over time as you work with micros in
different packages.
We put some effort into creating these
PCBs to make them flexible and easy to
work with. So any readers with similar
needs would benefit from being able
to use our PCBs and follow the same
general strategies.
PE
Practical Electronics | October | 2024
|