Sei sulla pagina 1di 4

Hack-a-day contest entry

This PIC/EEPROM programmer is so simple and small it fits on a business card with
enough room left for assembly instructions...
Project:
Simple JDM2 style PIC ICSP programmer (on a business card).
* all through hole *
* less than 2USD worth of parts (in 1s and 2s!) *
* easy single sided construction at home (with 3 jumpers) *
* enough room left for assembly instructions *
* extra space on the back for even more business-cardy goodness *
* also programs/reads serial EEPROMS *
Description:
Anyone can build this simple programmer and learn about PIC microcontrollers. The JDM2
programmer is super simple (about 10 parts), but programs a huge variety of PICS and serial
EEPROMs. I've programmed everything from an 8 pin 12F629 to a new 18F4550 USB PIC with the
JDM2. This programmer has an ICSP interface, meaning it can program PICs and read EEPROMs
while they are attached to a circuit board. Start your hacking!
The PCB can be made single sided (with three jumper wires), but a two layer design makes assembly
even easier. All the traces are nice and fat for easy toner-transfer or photo-process at home.
The JDM2 design is quite old, the original JDM2 circuit can be found here:
http://www.jdm.homepage.dk/newpic.htm
This design stays true to the old schematic, but the diode numbering now starts at 1, rather than 2.
Skill level:
Easy/beginner.
Assembly time:
About an hour.
BOM:
Part Value

Description

C1
100uF
C2
22uF
D1
8.2V zener
D2
5.1V zener
D3,4,5,6 1N4148
Q1,2 BC547B
R1
10K
R2
1.5K
SV1
5 pin header
X1
DB9 female

electrolytic capacitor
tantalum capacitor
diode
diode
diode
transistor-npn
resistor
resistor
pin header (or female pin header, you choose)
serial connector

Assembly:
Start from the bottom and work up:
Don't forget to begin with the jumper wires if you are using a single sided PCB.
1)Solder the diodes and resistors. Be sure the black band on the diodes is oriented in the same direction
shown on the board/in the schematic.
2)Next, add the transistors.
3)Finish the board by soldering the tallest components: the capacitors, pin header, and DB9 socket.
Software:
The programmer will work with any programming software that supports the JDM2. I like WinPic800
[LINK:http://perso.wanadoo.es/siscobf/winpic800.htm ] because it can auto-detect many PICs.
WinPIC also deserves credit for the great technical support info
[LINK:http://www.qsl.net/dl4yhf/winpic/ ]. Both support the newest USB PICs (18F2/4455). ICProg
does many PICs, as well as EEPROMs, but has not been updated in awhile [http://www.ic-prog.com/ ].
Use:
[from my ICSP instructable here: http://www.instructables.com/id/E28ZH040N7ES175W6I/?
ALLSTEPS# ]
Understanding ICSP for PIC Microcontrollers
Programming microcontrollers isn't hard. Building a programmer makes a great first electronics
project. The goal of this section is to explain the simple 'In Circuit Serial Programming' method used
with Microchip PICs.
Why ICSP?
Programming a big DIP (through hole) chip is easy. Pop it into a socketed programmer, burn, and
return to the application circuit. Test and repeat.
Things get more difficult with smaller (surface mount) chips. There are no standard sockets for QFN,
SSOP, QFP, or even the large SOIC .300 packages. There are really expensive ($100s) clips that can
attach to, and program, these chips. A different clip is needed for each chip type and pin count you use.
There is an alternative. Its called ICSP.
ICSP means 'in circuit serial programmer(ing?)'. It is a way of programming a PIC while it is still
attached to the application circuit. Thats right, no more chip swapping.
So, why is ICSP a good thing?
1. There are no programming sockets for small package chips. Clips are expensive.
2. Its a pain to move chips in & out of the programmer during development. Impossible for surface
mount parts.
What is ICSP?
Five connections are needed to program a PIC while attached to an application circuit. I add a 5 pin
header to my circuit boards to make this connection quick and easy.
The basics of PIC programming.
Five connections are required to program a PIC. Power, ground, a programming voltage, clock, and
data.
+ (Vdd)/-(Vss) These are the power & ground connections (Vdd, Vss). Pretty standard. If you are using
a programmer with 'real' voltage levels (NOT a JDM2!), your application can run from its own power

supply when programmed, eliminating these connections.


Vpp This is the programming voltage. PICs enter programming mode when ~13 volts are placed on the
MCLR/Vpp pin (usually pin 1 on modern PICs, more on that below).
Clock/Data or PGC/PGD The clock and data lines are used to write and read the PIC firmware. These
are sometimes the same pins as PORTB6 & PORTB7.
If the PIC fits, wear it.
I get a lot of questions about my JDM2 design on instructables. The most frequent is "Will it program
PIC X?'"' - here is how you can tell:
1) Look at the data sheet. Find the 'Pin Diagram'.
2) Identify the location of the pins that must be connected for programming (Vpp, Vdd, Vss, Data, &
Clock).
3) Look at the socket connection on the programmer. Can you match the required pins with a socket on
the programmer?
How do I, um, ICSP?
Depending on your design, you can now make all the required connections and program your PIC.
There are a few catches that you should know about. Design for ICSP is important. Microchip provides
a nice PDF application note about designing for ICSP.
http://www.microchip.com/stellent/idcplg?
IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011744
Here are some tips and examples of ICSP designs from my previous instructables.
Tip #1, Threat level: Important
Don't connect anything else to the CLOCK and DATA pins (usually RB6 & RB7, PGC & PGD).
Just don't do it. There are situations where very clever engineering types get away with it, but don't do
it. The components attached to the pins will skew the clock and data signals, resulting in unpredictable
programming. Additionally, if you ever want to use an in-circuit serial debugger, you can't. Just don't
do it.
Tip #2 Threat level: Explosive
Always use a diode between the programming voltage and system voltage.
If using MCLR (master clear) on a PIC you must provide some voltage on the MCLR pin through a
10Kish resistor. This is also the pin to which you will apply ~13 volts to enter programming mode. I
put a 1n4148 (equivalent) diode between the resistor and MCLR/Vpp pin. This keeps the programming
voltage on the Vpp pin, preventing destruction of other components on your board.
Tip #3 Threat level: (re)tired
Low voltage programming is holding you back, man.
I have never been successful with LVP. I have never seen it work (consistently) with my own eyes. Just
bite the bullet and spend $2 to build a JDM2 programmer.
Tip #4 Threat level: ugh!
JDM2 style programmers need a 'real' rs-232 level signal from your serial port. Some laptops have
cheap MAX202 (or similar) rs-232 tranceivers that only reach 10 volts, these will usually not work.
Some USB->Serial converters also contain cheap rs-232 tranceivers. If you're using any of the above,

and can't program, this is the likely cause.


ICSP programmers
ICSP does not require a different programming protocol. A socket-based programmer already produces
the required signaling, but sends it to the socket rather than through wires. Most socket programmers
can be used as an ICSP by rigging wires from the socket to the application circuit.
For example, the original JDM2 programmer (here: http://www.jdm.homepage.dk/newpic.htm ) can be
used to do ICSP programming by bringing the 5 required signals to a header. This can be seen in the
programmer here: http://www.belza.cz/digital/jdm.htm .
Similarly, my updated JDM2 programmer (here:
http://www.instructables.com/id/EN28KZDDYVEP286GRI/ ) can be used for ICSP by sticking wires
into the DIP sockets and connecting them to the target PIC.
*****JDM2s use funky voltages...connect it to the circuit WITHOUT external power (even ground!)
connected to the application circuit. Remove the ICSP connections before applying power. Failure to
do this is not destructive, but will result in failed programming*******
Another option is a (semi-)proper ICD programmer. ICD allows you to control firmware execution on
your PIC by setting break points in the code or reading out memory and port values. An ICD can also
animate the execution of code, power the application circuit, and program the PIC. It does all this
through the same 5 pin ICSP connection we have discussed. Several ICSP clones that you can make
yourself can be seen here: http://www.icd2clone.com/wiki/Main_Page .

Potrebbero piacerti anche