This is only a preview of the September 2023 issue of Silicon Chip. You can view 38 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Salad Bowl Speakers":
Items relevant to "pH Meter Module":
Articles in this series:
Items relevant to "Coffee Grinder Timer":
Items relevant to "PIC Programming Adaptor":
Items relevant to "30V 2A Bench Supply, Mk2 – Pt1":
Items relevant to "Voltage Inverter / Doubler":
Purchase a printed copy of this issue for $11.50. |
This small, low-cost adaptor lets you program
most newer PIC microcontrollers out-ofcircuit. It works in conjunction with a PICkit or
SNAP in-circuit programmer and provides five
different modes to suit a range of chips from
eight to 40 pins. It can even be used with SMD
chips in SOIC, SSOP or TSSOP packages.
Nicholas Vinen’s
PIC Programming Adaptor
T
his new programming adaptor
board is compact, easy to build
and suits a large range of PICs
released in the last 5-10 years, including many that we use in our projects.
As we sell programmed PICs (and
other microcontrollers) to build the
projects described in our magazine, we
have a box full of programming sockets, adaptors and other rigs to suit the
many different types of chips. Lately,
I realised that most of the time, we
were using just a few of those adaptors because we have transitioned to
mainly using recent PICs (released in
the last 5 years or so).
However, we still have to switch
between several rigs because recent
PICs still use a few different pinouts. For example, many of the latest 8-bit PICs use one configuration,
while PIC24s, dsPICs and PIC32s use
another. Some larger (eg, 40-pin) 8-bit
PICs use further configurations.
We previously published a fairly
comprehensive PIC & AVR programming adaptor in the May & June 2012
issues (siliconchip.au/Series/24).
While we still use that board quite
often, it was geared towards the chips
that were available back then, and
things have changed substantially.
Features & Specifications
> Adapts an in-circuit programmer like the Microchip PICkit or Snap to a ZIF socket
> Can deliver 3.3V or 5V to the target; target power can also come from the
programmer (if supported)
> Programs DIP chips directly or SMD SOIC/SSOP/TSSOP via low-cost adaptors
> PTC protection for the device being programmed (eg, in case it’s inserted in the
socket incorrectly)
> Supports most newer 8-bit PICs and most 16-bit and 32-bit PICs (including PIC24,
dsPIC, PIC32MM and PIC32MX) with 8-40 pins
> Tested PICs include 16F15213/4, 16F15323, 16F18146, 16F18857, 16F18877,
>
>
>
>
64
16(L)F1455, 16F1459, 16F1709, dsPIC33FJ256GP802, PIC24FJ256GA702,
PIC32MX170F256B and PIC32MX270F256B
Many more chips are supported than listed above
LEDs indicate source power present, target power present, voltage range and
programming activity
Simple to use with just five switches and silkscreened instructions
Includes ‘mouse clicker’ option to automatically trigger programming when the
target is powered
Silicon Chip
Australia's electronics magazine
Because it had to support so many different pinouts, it had certain compromises this newer design doesn’t have
to deal with.
Uses and function
You may not need this board if you
always design or build boards with
in-circuit serial programming (ICSP)
headers.
However, there are times when it
is convenient to program a chip out
of circuit; for example, if your board
is so compact that there’s no space for
an ICSP header, or you want to swap
chips out in the field. Or, like in our
case, you want to supply someone with
a pre-programmed chip.
You can build individual programming jigs for each type of chip – which
is what we did – but it can be annoying. You end up with many that you
must dig through to find the right one
each time. With this board, you just
flick a few switches and it’s ready to
program various chips.
Fig.1 shows the five different pin
configurations it offers. Each is colourcoded; the labels with that colour in
the background indicate the function
assigned to that socket pin in that
mode.
There are two settings for mode A
and one for modes B, C and D. The two
A modes suit almost all modern 8-bit
PICs, which are inserted with the pin
1 end at the bottom of the ZIF socket.
These all use the same pins for VDD,
GND and MCLR and mostly use the
siliconchip.com.au
same pins for programming (PGD =
data and PGC = clock).
The exception is devices with more
than eight pins, like the PIC16(L)F1455
and PIC16(L)F1459, which can use the
same programming pins as the other
devices – shown in red in Fig.1 – but
only for low-voltage programming
(LVP). Sometimes, low-voltage programming is disabled. In that case,
you must use mode A2, via the mauve
labelled pins.
Also, LVP could be disabled once
you program them, so you might need
to use the alternative mode for reprogramming.
Not all chips support programming on those pins (especially 8-pin
devices, which don’t extend that far!),
so we can’t always use the alternative
pins. Hence we use a dedicated switch
to select between the two A modes.
A separate four-throw switch selects
between the A, B, C and D modes.
In B, C and D modes, pin 1 is placed
at the top of the ZIF socket.
Mode B is for a few of the larger (40pin) 8-bit PICs that use a different pinout than provided in mode A for backwards compatibility with certain older
chips like the PIC16F877 (you can use
mode B to program those older chips
too). One example of a newer chip that
needs mode B is the PIC16F18877 that
we’ve used in a couple of projects,
such as the USB Cable Tester (November & December 2021; siliconchip.au/
Series/374).
Somewhat annoyingly, the 28-pin
version of that chip, the PIC16F18857,
cannot be programmed in mode B
because its supply pins are in different
locations (again, likely for backwards
compatibility). So mode C leaves PGD,
PGC and MCLR in the same places as
mode B but changes VDD and GND to
suit those chips.
Finally, mode D suits a very common pinout used by many 28-pin
devices, including much of the 16-bit
PIC24 range, the 16-bit dsPIC range
and the 32-bit PIC32MX range. We’ve
opted to use pins 4 and 5 as PGD and
PGC, respectively; many of these chips
support multiple different (usually
three) sets of programming pins, but
this pair (#1) is the most consistently
supported.
The only other slightly unusual
thing about mode D is that, in addition to connecting PGD, PGC, MCLR,
VDD and GND to various pins, a highvalue, low-ESR capacitor also needs
siliconchip.com.au
to be connected between pin 32 (pin
20 on the 28-pin chip) and GND. This
board connects a 47μF ceramic capacitor through a low-resistance Mosfet to
provide that function.
One advantage of this circuit compared to the 2012 Programming Adaptor is that because modern PICs mostly
use one of just a few pinouts, we only
need four modes, making the switching considerably simpler. That means
shorter paths between the ICSP socket
and the ZIF socket pins and fewer
components connected to those pins.
As a result, programming is more
reliable and programming speeds are
higher. The older Adaptor sometimes
requires you to reduce the programming speed to “slow” for it to work,
but this new Adaptor generally works
at “normal” and even “fast” programming speeds.
Circuit details
The full circuit is shown in Fig.2.
It looks complicated but isn’t hard to
understand if you break it into chunks.
All of the switching for MCLR
(which also sometimes carries VPP,
the high programming voltage), PGD
(data) and PGC (clock) is done by fourpole, four-throw slide switch S1. S1a
switches MCLR from the ICSP header
(CON1) to the appropriate pin on SK1
for each mode, with mode A at the top
and mode D at the bottom.
Similarly, S1b switches PGD (data)
and S1c switches PGC (clock) to the
pins of SK1. Thus, the only components in the path of these programming signals are CON1, SK1, S1 and
some short PCB tracks, minimising
signal degradation. One exception is
that the PGC/PGD signals also pass
through switch S2 in mode A, providing the two sub-modes, but the tracks
connecting it to SK1 are very short.
The fourth pole of S1, S1d, handles all the power pin switching (plus
VCAP). It does this by grounding one
of the four remaining switch pins.
For pins that need VDD applied in
this mode, that switch terminal connects to the gate(s) of P-channel Mosfet(s) with a shared gate pull-up resistor. So when that terminal is grounded,
the gates are pulled to ground, giving them a negative gate-source voltage and switching them on. In other
modes, the resistor pulls up the gate(s),
and they switch off, no longer driving
those pins.
For pins that need GND applied in
Australia's electronics magazine
a specific mode, the grounded pole is
connected to the gate of one of the six
inverters within IC1, a 74HC04 hex
CMOS inverter (with a pull-up resistor,
if one is not already present).
The inverter’s output goes high
when that pole is selected (pulling its
input low), and that high level drives
the gate(s) of one or more N-channel
Mosfet(s), pulling the appropriate ZIF
socket pins to GND.
The only variations from this
scheme are when multiple modes
need to drive the same pin. In this
case, diode logic is used to send the
right voltages to the Mosfet gates. For
example, dual diode D2 is configured
so that input pin 9 of IC1d goes low in
mode C or D. That causes IC1d’s output pin 8 to go high, switching on Q3,
which pulls SK1’s pin 8 low.
There are 100nF capacitors throughout the circuit connected between
socket power pins via the switching
Mosfets. That is, they connect between
the source pins of the P-channel (VDD
Fig.1: this shows how the five
programming pins are mapped
from the serial programmer to
the ZIF socket in each mode; pin
1 is at bottom right for modes
A1 & A2 and upper left for the
others. Some pins have the same
function in multiple modes, where
the background colour is split
between two or three modes. The
only pins with different roles in
different modes are 32, 39 & 40.
September 2023 65
Fig.2: routing of the MCLR, PGC and PGD signals from serial programmer header CON1 to ZIF socket SK1 is
straightforward, via 4P4T slide switch S1 and DPDT slide switch S2. Connecting GND, VDD and the 47uF capacitor
to the appropriate pins of SK1 is a bit more complicated. Switch pole S1d and hex inverter IC1 plus some diode logic
control Mosfets Q1-Q11 to apply the correct voltages to the right pins. The VDD indicator circuit is at lower right.
switching) and N-channel (GND
switching) Mosfet pairs. That is so
they do not affect any SK1 pins when
those Mosfets are off.
Pins 39 & 40
These are the only two pins that
need to be switched between programming (PGD/PGC) and power
pins. They are only used as power
pins in mode D, for the PIC24/dsPIC/
PIC32MX series of chips, where they
are the AVDD and AVSS pins. These
pins draw almost no current during
programming and a maximum of a few
milliamps if the chip is running code
that uses the ADC peripheral.
Mosfets have capacitance when
off; the AO3400 and AO3401 Mosfets
we’re using to switch power to the
66
Silicon Chip
other pins have rated output (drain)
capacitances of 75pF (15V/1MHz)
and 115pF (115pF/1MHz) respectively. The figures at 0-5V would be
even higher and could easily be high
enough to interfere with programming.
Therefore, we are using much
smaller Mosfets to switch power
to these pins. Q10 (2N7002K) is an
N-channel Mosfet with an output
capacitance of 13pF at 25V/1MHz,
while Q11 (BSS84) is a P-channel Mosfet with an output capacitance of 10pF
under the same conditions.
That’s a lot better, but it still could
possibly interfere with programming,
so 22W isolating resistors have been
added to reduce the effect on programming signals at those pins when
the Mosfets are off. That value was
Australia's electronics magazine
chosen to balance minimising the voltage difference between AVDD/AVSS
and VDD/VSS while also providing
reasonable isolation.
Pin 32 (VCAP)
The VCAP pin needs to be connected via a capacitor to ground in
mode D. That’s achieved simply by
permanently connecting a 47μF capacitor to that pin but switching its other
end to ground via N-channel Mosfet
Q5. This Mosfet is only on in mode
D. When off, the Mosfet’s ~100pF output capacitance is in series with the
47μF capacitor, making it effectively
a 100pF capacitor.
LED5 and its 4.7kW series resistor
across the VCAP capacitor are there to
discharge it should it become charged
siliconchip.com.au
Adaptor is switched into mode D and
Q9 switches off, the 47μF capacitor
rapidly discharges to around 1.8V via
LED5 (in around one second). LED5
will briefly light to let you know this
is happening. Once it extinguishes,
it is safe to insert a chip that’s programmed in mode D.
Target power switching
The target device (PIC) can be powered from a PICkit plugged into CON1.
However, there are many cases where
it’s more convenient to supply power
externally, and if you’re using a Snap
programmer, it can’t deliver power.
Therefore, switch S4 applies power to
the target device via PTC1, which goes
high-resistance if the target draws too
much current.
That’s only likely if you have the
wrong chip in the socket, the wrong
mode selected, or the target is orientated incorrectly. In these cases, PTC1
might prevent it from being damaged.
PIC16LF, PIC24, dsPIC and PIC32MX
devices all need a 3.3V supply, while
PIC16F devices can usually run from
3.3V or 5V. Some older chips require
5V for programming, although most
modern PICs can be programmed at
3.3V. Therefore, switch S3 can generally be left at its 3.3V setting, although
you can supply 5V to the target if you
wish.
Both the 3.3V and 5V sources come
from a Raspberry Pi Pico, MOD1,
which would typically be powered
from a USB charger or a computer
(presumably, the same one doing the
programming). LED1 indicates when
power is available from the Pico.
The Pico also provides the mouse
clicker function – more on that later. If
you don’t need that function, it’s still
a reasonable way to provide power
to the board, but you can leave it off
and fit USB connector CON2, regulator REG1 and its input and output
capacitors. REG1 is a low-dropout regulator providing a 3.3V rail from the
USB 5V supply.
Programming indication
above about 1.8V. That’s because pin
32 is also VDD in modes B and C, so
if you have the power on and switch
between modes C and D, there will be
a brief overlap between the application
of VDD to pin 32 and Q5 switching
on, so the 47μF capacitor will charge
to VDD.
siliconchip.com.au
This capacitor could hold that VDD
voltage for a long time. When a target
device is later inserted in SK1 that
uses pin 32 as VCAP, that capacitor’s
charge would be dumped into that pin,
which is only intended to handle up
to about 1.8V.
To prevent that, as soon as the
Australia's electronics magazine
LED2 lights when there is an AC
waveform at the PGD pin of CON1.
This signal is coupled via a 100pF
capacitor and biased to 0V with a
1MW resistor to minimise any effect
on the actual programming. Whenever
PGC goes low, the 100pF capacitor
discharges through diode D4. When
it goes high, input pin 13 of inverter
September 2023 67
VDD is above 5.5V; however, the USB
supply should never be high enough to
allow that, nor should the VDD output
of a PICkit. Also note that if you change
the colour of LED3 to anything other
than red, yellow or amber, it might not
light up for lower VDD voltages (1.82.2V and possibly higher, depending
on its colour).
Mouser clicker
The underside of the PIC
Programming Adaptor
shown at actual size with
and without the Raspberry
Pi Pico. These photos are
just prototypes, in the final
version D1-D5 are BAT54A diodes,
while D6 is the sole BAV99 as shown in Fig.2.
IC1f goes high, so its output goes low,
lighting LED2, which draws around
1-2mA.
Because PGD toggles very fast, LED2
should appear to light solid when PGD
is toggling, albeit at reduced brightness.
You might notice that the prototype was built with LED1 as green
and LED2 as blue, while everything
else shows it the other way around.
That’s because a blue LED typically
has a forward voltage of at least 3V,
so it seemed to make more sense in
hindsight for LED1 to be blue, as it’s
powered from 5V, while LED2 could
be powered from 3.3V or less.
In practice, the blue LED2 on our
prototype lights up just fine with VDD
at 3.3V, and we don’t intend to program chips at voltages below that. Ultimately, it’s up to you how you arrange
the colours.
LED3 and LED4 are provided so that
you know when power is applied to
the target and that it is in the expected
voltage range. Dual comparator IC2
provides this function. A ~0.6V reference voltage is developed at pins 3
and 5 of IC2 by half of diode D6, which
is forward-biased by a 5.1kW resistor
from the VDD rail.
68
Silicon Chip
A 22kW/5.6kW/4.7kW divider across
the VDD rail applies two fractional
voltages to pins 2 and 6 of the same
chip. These are roughly 16% and 33%
of the VDD voltage. Therefore, the output of comparator IC2a goes low when
VDD exceeds 0.6V ÷ 33% = 1.8V, and
the output of IC2b goes low when it
exceeds 0.6V ÷ 16% = 3.75V.
Note that the ~0.6V reference from
D6 varies slightly with VDD; hence,
the percentages and voltages above
are not exact. LED3 comes on with a
supply voltage just below 1.8V (dimly,
since that’s barely above the LED’s
forward voltage), while LED4 comes
on a little over 3.8V, which is higher
than the 3.6V indicated. Still, in most
cases, VDD will either be below 3.6V
or above 4.5V.
If VDD > 3.8V and output pin 7 of
IC2b is low, LED4 is forward-biased
and lights with around 6mA ([5V – 2V]
÷ 470W). At the same time, diode D5 is
forward-biased and pulls the anode of
LED3 low, so LED3 cannot also light.
If VDD < 3.8V and LED4 is off, LED3
will light if output pin 1 of IC2a is low.
That is the case when VDD is between
1.75V and 3.8V. The 470W resistor limits its current to a few milliamps.
Note that LED4 will not extinguish if
Australia's electronics magazine
The mouse clicker using the Raspberry Pi Pico was previously described
in Circuit Notebook (February 2023;
siliconchip.au/Article/15668). When
connected to the computer, the Pico
appears as a mouse and triggers a
click whenever its GP1 pin (pin 2) is
pulled externally high. This will be
the case when VDD is switched on as
long as slide switch S5 is in the correct position.
You position the mouse cursor over
the “Program” button on your software, then, with the programming rig
already set up, you put the chip in the
ZIF socket and switch target power on.
The Pico will click the Program button, and the chip will be programmed.
You can then switch the target power
off, remove the chip and insert another
one, ready for programming.
The whole process can take just a
few seconds per chip.
The Pico will do nothing with S5
off as there is nothing to pull its pin
2 high; an internal pull-down current
keeps that pin low.
Construction
The Programming Adaptor is
built on a 65.5 × 66mm PCB coded
24105231. We had ours made with a
blue solder mask because we thought
it’d look nice, especially as many people would use it as a bare board. There
are components on both sides; Figs.3
& 4 show where they are mounted.
The top side mostly has the connectors and switches, with almost
all the Mosfets on the underside. The
Pico mounts on the underside too. We
have purposefully avoided putting any
components under it, but there are solder joins for SK1, S3 and S4 under it,
so it needs to be mounted on headers
for spacing. We’ll get to that a bit later.
The first parts to fit are the SMDs,
as they are pretty flat. Because most of
them are on the underside, it’s best to
start there. All SMD components on
the underside are either 3.2 × 1.6mm
(imperial 1206) passives (including
siliconchip.com.au
the PTC) or three-pin SOT-23 package
Mosfets or diodes.
Start with the SOT-23 package
devices, ensuring you don’t mix up the
six or seven types. Their orientations
should be evident but watch that you
don’t accidentally try to solder them
upside-down, with their leads sticking
up in the air, ‘dead bug’ style.
You don’t need to fit REG1 if you
will use the Pico (which we recommend).
For parts like Q2, where its central
pin is very close to a through-hole pad,
avoid getting solder on that nearby
pad. If you do, and it goes into the
hole, you might have difficulty soldering the ZIF socket later. If you get
some in there, clean it up as best you
can with flux paste and some solder
wick or a solder sucker.
For each 3-pin device, tack one
lead, check the positioning, then solder the other two. Adding a tiny bit
of flux paste on the three pads from
a syringe before locating the part will
make the solder flow much more easily. Verify that all three solder joints
are shiny and have adhered to both the
pin and the pad; if they are not shiny,
add a touch of flux paste to the joint
and touch your iron to it to reflow it.
With all the SOT-23 devices in place,
move on to the resistors, capacitors
and PTC thermistor that mount on the
underside, none of which are polarised. The two capacitors right next to
REG1 do not need to be fitted if you
are not using REG1.
The resistors will be printed with
codes like 102 or 1001 for 1kW, 1005
We designed this as a
compact board so it doesn’t
take up much space on
your workbench, even
with a PICkit or similar
hanging off the side. That
requires the controls to be
closely spaced together,
but we find them all to be
accessible enough during
use. This version of the PCB
lacks SMD LED5, which was
added later.
or 106 for 10MW etc. Use a magnifier
to read them, if necessary. The capacitors will not be labelled, so take them
out of their packages one lot at a time
and solder them in place so you don’t
get them mixed up.
Now is a good time to clean flux
residue off the board; we really like
Chemtools’ Kleanium Deflux-It G2
Flux Remover, but you can use some
alcohol or acetone instead if that’s all
you have on hand. Inspect the solder
joints under magnification to verify
they’re all good.
The only remaining components to
fit on the underside are either the Pico
or USB socket, depending on which
you’re using, but leave them off for
now and flip the board over. Solder
the two SMD ICs, ensuring their pin 1
indicators (dots, chamfered edges etc)
are at upper left, as shown in Fig.3.
These are in SOIC packages with
relatively widely spaced pins. After
tacking one and checking the placement and orientation, you can either
solder the remainder individually or
apply some flux paste along the edge
and drag solder the pins. Then mount
Q5 (the only SOT-23 package device
on the top side), then the resistors
and capacitors, using the same technique as before. None of the passives
are polarised.
Note that the 47μF capacitor may be
the same size as the others or a little
larger. Larger pads are provided that
suit a range of components from 2.0
× 1.2mm (imperial 0805) up to 3.2 ×
2.8mm (imperial 1210).
Figs.3 & 4: fit the
components on
the relatively
compact PCB
as shown here.
We recommend
doing it in two
stages, with the
first stage mostly
involving fitting
the SMDs, starting
on the underside,
plus a few of the
through-hole
parts. Watch the
orientations of the
ICs and LEDs.
siliconchip.com.au
Australia's electronics magazine
September 2023 69
With all the SMDs in place, clean
any flux residue off the top of the
board, as you did for the underside,
and inspect the solder joints.
Next, install the five LEDs. The four
3mm through-hole types are all orientated the same way, with the shorter
(cathode) leads and flat lens edges
towards the nearest edge of the PCB.
We pushed them down flat onto the
PCB before soldering the leads to keep
them neat, but you could stand them
off a little if you want to.
The SMD LED, LED5, is soldered
similarly to the resistors and capacitors. It should have a small green dot or
perhaps a T on the underside indicating the cathode, which faces towards
the bottom edge of the board. If you
aren’t sure, set a DMM on diode test
mode and probe the two ends of the
LED. When it lights up, you have the
red probe on the anode and black on
the cathode.
The three remaining components to
Step 1: check continuity
Mode A1
– CON1 pin 1 to SK1 pin 24
– CON1 pin 4 to SK1 pin 19
– CON1 pin 5 to SK1 pin 18
Mode A2
– CON1 pin 1 to SK1 pin 24
– CON1 pin 4 to SK1 pin 16
– CON1 pin 5 to SK1 pin 15
Mode B
– CON1 pin 1 to SK1 pin 1
– CON1 pin 4 to SK1 pin 40
– CON1 pin 5 to SK1 pin 39
Mode C
– CON1 pin 1 to SK1 pin 1
– CON1 pin 4 to SK1 pin 40
– CON1 pin 5 to SK1 pin 39
Mode D
– CON1 pin 1 to SK1 pin 1
– CON1 pin 4 to SK1 pin 4
– CON1 pin 5 to SK1 pin 5
Step 2: check voltages
Mode A1 / A2
– SK1 pins 21 (red) & 20 (black)
Mode B
– SK1 pins 11 (red) & 12 (black)
– SK1 pins 32 (red) & 31 (black)
Mode C
– SK1 pins 32 (red) & 8 (black)
– SK1 pins 32 (red) & 31 (black)
Mode D
– SK1 pins 40 (red) & 39 (black)
– SK1 pins 13 (red) & 8 (black)
– SK1 pins 13 (red) & 31 (black)
70
Silicon Chip
solder at this stage are switches S1 and
S2 and header CON1. Before soldering the pins, ensure the switches are
fully flat on the PCB. As S1 has many
fairly small pins, it’s a good idea to dab
a little flux paste on each before soldering them to ensure they flow properly. Any bad joints here will cause
problems later.
S2’s solder lugs go into generously-
sized slots on the PCB. The solder
should flow in and quickly join them
to the PCB; if in doubt, add more.
We suggest using a right-angle
header for CON1, with the pins sticking out over the edge of the PCB, to
keep the serial programmer out of
the way in use (see our photos). Still,
you could use a vertical header if you
want to.
Testing
We now have enough components
mounted on the board that we can do
most of the testing before fitting the ZIF
socket or Pico. You can still fix problems after that, but it will be harder, so
let’s test it now. Fit four tapped spacers to the corners of the board using
short machine screws so it will sit flat
on your desk.
We used two male/female jumper
wires to connect to pins 2 & 3 of CON1
for applying power to the board from a
bench supply. We suggest you do similar. Be careful with the polarity; the
middle pin (pin 3) is GND, while pin
2, closer to the top, is VDD. If possible,
start at 0V and slowly wind it up while
monitoring the current draw. It should
not exceed 30mA; if it does, switch it
off and check for faults.
Once VDD exceeds about 1.8V, you
should see LED3 starting to light. It
will be pretty dim, though. LED1 will
remain off as we are feeding power
directly into VDD and not the 5V rail.
LEDs 2 & 4 should also stay off at this
stage.
Wind up the voltage to about
3.8V, and you should find that LED3
switches off and LED4 switches on.
Continue increasing VDD to 5.5V, at
which point LED4 should be pretty
bright and the circuit should be drawing around 20mA. That confirms that
IC2 is functioning correctly.
If something different happens,
check the soldering on IC2 and its
surrounding components. Check
that IC2 has been installed the right
way around and that the surrounding component values and types are
Australia's electronics magazine
correct. Also check the orientations
of the LEDs.
Assuming that’s fine, wind the supply back to 3.3V. We are now ready
to check all the routings for programming chips in the five different modes.
To help you do this, we’ve added ZIF
socket pin numbers to the top of the
PCB since building the prototype.
While you could work out the connections based on Figs.1 & 2, to make
things easier, here are all the connections you need to probe. We’ll start
with MCLR, PGD and PGC. Set a DMM
to continuity test/buzzer mode (or low
ohms if your meter doesn’t have such a
mode) and then check that all the pin
pairs in the Step 1 box are connected
in each mode, set using S1 & S2.
If any of these lack continuity or
have a resistance reading above 1W,
that suggests a bad solder joint on
CON1, S1 or S2, so check those. They
are the only components making those
connections. The only other problem
could be a faulty PCB, but that’s very
unlikely. Still, if you’ve ruled the other
parts out, you will have to trace the
tracks and check them.
Next, we check that GND and VDD
are fed to the correct pins in each
mode. Set your DMM to measure volts
(eg, 20V range or similar) and then
probe the pairs of pins in the Step 2
box in each mode. In each case, you
should get a steady 3.3V (or whatever
the exact voltage you are applying to
the circuit is).
If any of those are wrong, look for
soldering or component placement
problems with IC1 and the components like Mosfets, diodes & resistors
associated with the problematic pin(s).
Finally, measure the capacitance
between pins 32 and 31 with it still set
to mode D. You should get a reading
close to 47uF. If you don’t have a suitable meter, check the voltage between
pins 32 and 31. It will likely be around
1.8V, slowly dropping as the capacitor
discharges through your meter. If it’s
near 0, switch to mode C and back to
mode D (LED5 should light briefly),
then check again.
If you measure more than 2V
between pins 32 and 31, something
is wrong with the protection circuitry
involving LED5, so check its orientation and soldering, and the soldering
of its 4.7kW series resistor.
Finishing it
Remove the spacers from the corners
siliconchip.com.au
of the board and solder switches S3,
S4 and S5 in place, making sure they
are pushed all the way down and
neatly aligned and vertical (solder one
pin, check, then solder the rest). That
leaves SK1 and the Pico (or USB socket
CON2 if you aren’t using the Pico).
If not using the Pico, solder CON2
now, checking that its small pins
are correctly aligned with their pads
before soldering the four through-hole
mounting tabs. Then solder the signal
pins, being careful not to bridge them
(use flux paste and wick to fix it if you
do) as they are very close together.
Mounting the Pico is a little tricky
since one of its rows of pins is opposite
the ZIF socket. The ZIF socket has only
about half a millimetre of clearance
between its plastic body and the top
of the PCB, and we’ve used throughhole headers for simplicity. Luckily,
it isn’t all that hard to work with this
arrangement.
Our solution is as follows, although
we’ll mention another possibility later.
We started by inserting two low-
profile 20-pin female headers into
the rows of Pico pins on the underside of the board. Then we inserted
two 20-pin regular male headers with
the short sides into those sockets and
placed the Pico on top, with the longer pins going through its pads. The
Pico’s USB socket faces away from the
main board (see the photos).
We then pushed the two sockets
fully onto the PCB and made sure they
were perpendicular to it before soldering all their pins. After that, we soldered the headers to the pads on top
of the Pico. Note that you could solder
the headers in the usual manner – with
the short pins on the Pico side – but
then the headers will not fully insert
into the low-profile sockets.
A neater option would be to use
low-profile headers on the Pico, allowing you to use slightly shorter (eg,
12mm) spacers as feet for the board.
The trick now is to use a pair of
sharp sidecutters to snip all the header
socket solder joints as close to the PCB
as possible that will be under the ZIF
socket. Don’t cut the whole solder joint
off but try to keep each one to a maximum of around 1mm above the top
of the board.
You can then insert the ZIF socket
into its pads (straightening its pins if
necessary). It won’t quite push down
all the way, but all its pins should go
through the PCB and stick out the other
siliconchip.com.au
Parts List – PIC Programming Adaptor
1 double-sided PCB coded 24105231, 65.5 × 66mm
1 6-pin header, straight or right-angle (recommended), 2.54mm pitch (CON1)
1 Raspberry Pi Pico (MOD1)
(optional; alternative power supply parts are listed below)
1 40-pin universal ZIF socket (SK1)
1 4P4T vertical PCB-mount slide switch (S1) [SS-44D02-G10]
1 DPDT sub-miniature vertical solder tag slide switch (S2)
[Jaycar SS0852, Altronics S2010]
3 SPDT micro vertical slide switches (S3-S5) [Jaycar SS0834]
4 M3-tapped 15mm hex spacers
(can be 12mm if low-profile headers are soldered to Pico)
4 M3 × 6mm panhead machine screws
2 20-pin low-profile female headers, 2.54mm pitch (for MOD1)
2 20-pin headers, 2.54mm pitch
(for MOD1; ideally low profile but regular headers will work)
Semiconductors
1 74HC04 hex CMOS inverter, SOIC-14 (IC1)
1 LM393 dual single-supply comparator, SOIC-8 (IC2)
5 AO3400 logic-level, low Rds(on) N-channel Mosfets, SOT-23 (Q1-Q5)
4 AO3401 logic-level, low Rds(on) P-channel Mosfets, SOT-23 (Q6-Q9)
1 2N7002K logic-level N-channel Mosfet, SOT-23 (Q10)
1 BSS84 logic-level P-channel Mosfet, SOT-23 (Q11)
4 3mm LEDs with diffused lenses; blue, green, red & yellow (LED1-LED4)
1 SMD high-brightness red LED, M3216/1206/SMA package (LED5)
5 BAT54A dual common-anode schottky diodes, SOT-23 (D1-D5)
1 BAV99 dual series signal diode, SOT-23 (D6)
1 100mA PTC thermistor (PTC1) [eg, 1206L050YR]
Capacitors (all SMD X7R ceramic, M1206 or M0805 size unless noted)
1 47μF 6.3V X5R or X7R, M3226/1210, M3216/1206 or M2012/0805 size
7 100nF
1 100pF
Resistors (all SMD 1%, M3216/1206 or M2012/0805 size unless noted)
1 10MW 5% 1 1MW
2 100kW
1 22kW
1 5.6kW
6 5.1kW
2 4.7kW
1 1kW
3 470W
2 22W
Parts for optional USB power supply
1 SMD micro-USB socket (CON2)
1 MCP1700T-3302E/TT 3.3V low-dropout linear regulator, SOT-23 (REG1)
1 10μF 6.3V X5R or X7R ceramic capacitor, M3216 or M2012 size
1 100nF 50V X7R ceramic capacitor, M3216 or M2012 size
Optional SMD adaptor recommendations
Narrow SOIC (0.15”), 8-16 pins [AliExpress; siliconchip.au/link/ablr]
Wide SOIC (0.3”), 20-28 pins [AliExpress; siliconchip.au/link/abls]
MSOP-8 [AliExpress; siliconchip.au/link/ablt]
SSOP-28 [AliExpress; siliconchip.au/link/ablu]
TSSOP-28 [AliExpress; siliconchip.au/link/ablv]
(unsuitable for SSOP, despite what the description says!)
side by about 1mm, which is enough
to solder them comfortably. You might
want to put ~1mm shims under it
at both ends so it’s sitting evenly,
although we evened it up by eye.
Optionally, add a little flux paste
onto the ZIF socket pads before soldering all 40 pins. That will ensure
the solder flows smoothly and wicks
into the through-holes around the
pins, giving a solid mechanical and
electrical bond.
The other option we considered,
Australia's electronics magazine
which is a bit simpler, was first fitting
SK1 pushed all the way down, then
soldering headers to the Pico in the
usual way. It is then possible to insert
those headers into the PCB pads until
they touch the underside of the ZIF
socket, making sure it is parallel to
the main PCB, then solder them from
the side. However, that will make the
Pico captive.
We purposely avoided putting any
components under the Pico, so that
is not unreasonable, but half the ZIF
September 2023 71
The PIC Programming Adaptor can be used with a variety of SMD-to-DIP adaptors, allowing you to program SMD chips.
For example, the adaptors shown above plug directly into the 40-pin ZIF socket. The adaptor on the right is actually for
an ATmega328; we’ll have more on programming SMD chips in next month’s issue.
socket solder joints will be inaccessible. So you’ll want to ensure they are
all good before doing that.
Only pins 2, 36, 38 & 39 of the Pico
need to be soldered. All the GNDs are
connected on the board, but one (eg,
pin 38) is sufficient. So you could solder just those pins, allowing you to
desolder it later if necessary.
Finally, reattach the spacers to the
corners of the board to act as feet.
Final testing
You can now plug the board into
your computer via a USB cable and
check that LED1 lights. Switch on
S4, and either LED3 or LED4 should
light, depending on the position of
S3. Switching S3 should alternate
between LED3 on/LED4 off and LED4
on/LED3 off.
You can now test program a chip.
Switch it off, select the appropriate
mode and put the chip in the ZIF
socket. Plug your serial programmer
into CON1 and ensure S3 is set to the
appropriate voltage (3.3V is safe). Set
S5 off, then switch on target power
with S4. Check that your programming
software can connect to, program and
verify the chip.
If you are using the Pico, switch off
the target power and set S5 on to test
the mouse clicker. Put your computer’s mouse over something that will let
you know if it’s clicked, then switch
S4 on. Your computer should act like
the mouse was clicked.
Using it
It’s pretty straightforward, but we
have a few hints. Firstly, you might
want to stick a rubber foot to the underside of your serial programmer or place
PIC Programming Adaptor Kit
SC6774 ($55): a complete kit is
available which includes the Pi
Pico, but does not include the
optional USB power supply parts.
72
Silicon Chip
something about 12mm thick under it,
so it doesn’t try to pull the board over.
While you can change the mode
with the target power on, doing that
with it off is safer. Don’t change the
mode with the target power on if
there’s a chip in the ZIF socket. In general, it’s best to fully set up the programming rig before inserting a device
to program.
All the chips we tested can be programmed at 3.3V, so you can generally
leave S3 on that setting. That way, you
won’t accidentally apply 5V to a chip
with a maximum 3.6V rating. Some
older chips that are compatible with
this board need 5V for programming; if
doing that, we suggest changing back to
3.3V immediately afterwards to be safe.
If you change to mode D with the
power on, ensure LED5 is not illuminated before inserting a device in the
ZIF socket. You might notice LED5
glowing very dimly with target powered enabled in mode D; that is normal.
If programming several chips using
Microchip MPLAB IPE, after you’ve
used the Connect button to let the
programmer identify the first chip,
hover the mouse cursor over the “Program” button, then switch on the target power. It should trigger programming almost immediately. When that
finishes, switch off the target power,
remove the chip, insert the next one,
and switch the target power back on.
Repeat as needed.
If you have a PICkit, you can let it
power the target chips. In that case,
you will need to Disconnect/Reconnect each time so that you aren’t pulling a chip out of the ZIF socket while
it’s powered. When powering the target from the PICkit, leave S4 off.
Programming SMD chips
You can also use this Adaptor to
program compatible chips with up to
28 pins in packages like SOIC, MSOP,
SSOP and TSSOP. To do that, you need
Australia's electronics magazine
the appropriate SMD-to-DIP adaptor
(also known as “test sockets”). They
are not overly expensive, but you may
need a few different types. Some we
recommend are in the parts list; here
are more details:
1. A 28-pin TSSOP adaptor will let
you program any TSSOP chip we have
come across, from 8 pins to 28 pins,
although the common pin counts for
TSSOP chips are 14, 20, 24 or 28 pins.
2. Similarly, a 28-pin SSOP adaptor
will let you program any SSOP chip.
While TSSOP and SSOP are very similar, they are not the same width, so
you can’t program an SSOP chip in a
TSSOP socket and probably can’t do
the reverse.
3. Some 8-pin PICs are available
in the even smaller MSOP package.
For those, you will need an MSOP-
specific socket.
4. SOIC/SOP chips come with 8 to
28 pins and, unfortunately, in different
widths. Most chips below 16 pins are
0.15” (3.8mm) wide, while most chips
from 20 to 28 pins are 0.3” (7.6mm)
wide. 20-pin chips can come in either
width. The sockets in the parts list suit
these two widths, but be aware that
0.2” (5.1mm) wide SOIC/SOP chips
also exist.
Coming up
Programming other SMD chips out
of circuit, like SOT-23-5/6, TQFP32/44/48/64/100 and others is possible, but it is less commonly required
than the DIP and SOIC chips this
Adaptor can handle. Still, we need
to do it as we sell those chips programmed, and some readers may want
to do that as well.
We have designed suitable rigs, and
they are not easy to find commercially
(or at reasonable prices). So we will
have an article next month explaining how to program various types of
micros (PICs, AVRs and others) in
those packages.
SC
siliconchip.com.au
|