Silicon Chip – July 2019

(Frankie) #1

88 Silicon chip Australia’s electronics magazine siliconchip.com.au


PICkit 3 or PICkit 4 (or similar), you
don’t necessarily need to power the
board up to do this; the programmer
can supply power to program the chip,
and indeed, it is safer to do it this way.
As mentioned last month, the pro-
gramming header (CON23) does not
have the same pinout as the PICkit 3/4,
so you need to make up an adaptor to
connect it. This could be as simple as
five male/female jumper leads plugged
into CON23 at one end, and the ap-
propriate PICkit pin at the other end.
Or, you could crimp a 10-pin IDC
line socket onto a spare section of 10-
way ribbon cable, then separate the
wires at the other end, cut some off
short and solder the others to a 5-pin
header. You can then plug the PICkit
into that header.
To program the chip in our proto-
type, we soldered a 5x2 pin box head-
er onto a small piece of veroboard,
along with a 5-pin right-angle header,
and then made the five required con-
nections using short lengths of Kynar


(wire wrap wire) soldered between
the pads.
Regardless of the method you
choose, the required cable configura-
tion is shown in Figs.16(a) and 16(b).
Remove jumper JP5 during program-
ming and re-insert it when finished.
If using a PICkit, you can load the
HEX file into the PIC32MZ chip using
the free Microchip MPLAB IPE soft-
ware, which is installed along with
the MPLAB IDE (also a free download).
Grab this from the following link: mi-
crochip.com/mplab/mplab-x-ide
Having installed the IPE (if you
don’t have it already), launch it and
change the Device field to “PIC-
32MZ2048EFH064” (see Fig.17). If you
can’t find that device in the list, you
need to update to the latest version of
the software.
Plug in your programming tool, then
select it from the list and click “Ap-
ply”, then “Connect”. If your tool does
not support this chip, you will get a
message saying so.

Fig.18: to make
things easier,
rather than
powering the
board externally,
the PICkit can
supply power
to IC11 during
programming, as
long as you have
checked this box.

Fig.19: now we
can load our HEX
file, connect to the
PIC and program
it. If successful,
you should get the
same messages in
the bottom pane
as we did here.

You may get an error message say-
ing that no power was detected and
the connection has failed. This is fine,
as we want to ensure that the PICkit
is set up connectly before applying
power to the chip.
Now, to the right of “Hex File”: be-
low, click “Browse” and select the HEX
file which you have unzipped from the
download package for this project, ob-
tained from the SILICON CHIP website.
Next, click on the “Power” tab on the
left side of the screen. You may need
to switch the software to “Advanced
Mode” to access this tab. Ensure that
the “Power Target circuit from Tool”
option is ticked (Fig.18).
Switch back to the “Operate” tab,
check that your programmer is con-
nected to the CPU board correctly (if
not, click the “Connect” button again)
and press the “Program” button. You
will get a series of messages at the bot-
tom of the screen indicating the pro-
gress (Fig.19).
If programming failed or you get a
message that the software is unable
to detect or connect to the target de-
vice, check your wiring. If that’s good,
then you may have a problem with the
soldering of IC11 or some associated
components, or you may have one or
more solder bridges on the board. Ex-
amine it carefully for faults.
Our first attempt to program the chip
in our prototype failed. We carefully
examined all the pins of IC11 under
magnification, but couldn’t see any
obvious problems like bridges or un-
soldered pins. We solved this by add-
ing flux paste to all the pins of IC11
and then re-flowing the solder using a
hot air rework station. So that is worth
trying if you can’t figure out why it
isn’t working.
We are guessing that the solder on
one of the pins on our chip hadn’t
flowed down onto the pad below, but
it’s hard to say for sure. Whatever the
problem was, it’s gone now.
Assuming IC11 is soldered correct-
ly, and your programmer is wired up
as shown, the chip should be success-
fully programmed and verified. You
can then move on to the next stage
of testing.

Further testing
The next step is to test the control
circuitry. You will now need the three
10-wire ribbon cables you made up
earlier (described at the end of last
month’s article). In each case, make
Free download pdf