Pages

Sunday, September 9, 2012

JDM programmer

If you look in Internet for a PIC programmer, you will find tons of pages with info about homemade programmers. But you must be cautious. Most programmers were designed for the 16F84/16F84A microcontroller, and today, the 16F84 is considered an obsolete device. So if you want a working programmer today, you must look for one capable to program current PICs.

After many pages visited, I decided to build the Multi PIC Programmer 5 version 2. You can find it here. It's based on the well known JDM programmer, but with some features for today PICs. I build exactly that programmer, with a small modification.

I was interested in program also EEPROMS, and the JDM programmer is able to do it, but there is a little problem. If you look carefully at the original JDM schematics, you will find that the EEPROM pin number 7 (RB7) is connected to the DATA line. This is no problem if the 24Cxx EEPROM has a no connection on that pin, but many manufacturers has used that spare pin for some exotic functions, like write protect or test functions... so this kind of memories can't be programmed with this programmer.

Because all PICs I was interested in are 20 or less pins, I reused an old ZIF socket I had from a previous Atmel programmer to do both tasks: Program PICs and 24Cxx EEPROMS. This is the final modified schematics:


(click to enlarge)

Theory of operation

Theory of operation is quite simple. In the original Multi PIC Programmer all 8, 14, 18 and 20 pin PICs are placed at the same 20 pins, so I used the remaining 8 pins to wire an EEPROM memory with the 24Cxx pin 7 connected to ground. This permits reliable operation with all those memories with extra functions, so the final devices positions are:

Position

Devices:

8 pin PICs

 

PIC12C508 / 508A / 509 / 509A
PIC12C671 / 672
PIC12CE518 / 518 / 673 / 674
PIC12F508 / 509 / 510
PIC12F615 / HV615
PIC12F629 / 635 / 675 / 683

14 pin PICs

 

PIC16F616 / HV616
PIC16F630 / 636 / 676 / 684 / 688
PIC16F505 / 506

18 pin PICs

 

PIC16C620A / 621A / 622A
PIC16CE623 / 624 / 625
PIC16F54
PIC16C710 / 711 / 712 / 715 / 716
PIC16F627 / 627A / 628 / 628A / 648A
PIC16F716
PIC16F84 / 84A
PIC16F818 / 819
PIC16F87 / 88
PIC18F1220 / 1230 / 1320 / 1330

20 pin PICs

 

PIC16F631 / 639 / 677
PIC16F685 / 687
PIC16F689 / 690 / 785

24Cxx EEPROMS

 

24Cxx

There is a switch in the programmer. It selects the power-up sequence for the microcontroller. If the switch is off position, the programmer applies Vcc first, and some milliseconds later, Vpp. But some PICs can be used with its internal oscillator, so they start to run as soon they get Vcc applied. To overcome this situation, put the switch at the on position and the programmer will apply Vpp first, and Vcc later: In this way the PIC will not run its program and can be accessed by the programmer.

Construction

Construction is very easy. I mounted it in a small plastic box, only a bit larger that the ZIF socket. The circuit were mounted in a prototype solder board. I used 100% surplus components, including some SMD resistors that helped to keep the board small.


Once the circuit was mounted and tested, I wired the ZIF socket with some pieces of wire and wired it to the main board.


And finally, the complete programmer, in a very nice and small box:




Results

Results are dependent on your hardware. If you have a real serial port, I mean, a real UART connected to your CPU buses, the programmer works quite well. I tried it connected to the (only) serial port on my computer, and I discovered that my DTR line was dead. The next step was to buy a USB-Serial adapter, and the funny story began.

USB-Serial converters works nicely for the task they were designed: Serial communications. The programmer make a very unusual use of the serial port as a bunch of input/output lines, moving them high/low in a very fast way to simulate the correct waveforms the chip needs to be programmed. USB-Serial adapters are not good AT ALL for do this kind of things.

So the results are bad. I'm able to read/write 24Cxx EEPROMS without any problem, as you can see here with an Atmel 24C02N:


But when I tried to read a blank PIC, I only get garbage and hundred of errors while programming:


Further experiences revealed the USB-Serial adapter is very lazy setting lines up/down or reading its state, so bits are read/write out of order. In other words: Garbage. If this is the cause, why I can program I2C devices? I suspect the answer is: They use a protocol. An I2C master can (must) wait for the slave device (the EEPROM). This waiting period is enough for the USB-Serial driver to react correctly and the transfer works. PICs do not use I2C protocol, so they doesn't work.

Conclusions

I suspect the ages of simple programmers has reach the end. Serial and parallel ports are now very rare in modern computers but USB ports are everywhere. Next generation of programmers use a USB connection to the computer. Operation is very easy: A USB-Serial converter is used to send commands to a microcontroller inside the programmer (The USB-Serial converter works nicely in this way) and that microcontroller interacts with the target device. This system works everywhere.

The main disadvantage for the home electronic hobbyist, is you need a programmed PIC to build your programmer... So, if you don't have a programmer, you can't program the PIC for your programmer... I guess you get the idea.

2 comments:

  1. Hi ,

    It is not the USB-Serial speed. Mostly, these chips are fast enough to handle USART speed.
    The most problem of JDM programmer are "the supply voltage" which drawn from serial port TxD, DTR, and RTS pins. If these pins are lower than 9V, the programmer don't simply work.
    Unlucky, nearly all of USB-Serial cables in the market cannot provide these voltage.
    BTW, it is a nice blog.
    Cheers,

    ReplyDelete
  2. Hi G8RSI here, I like your programmer design. Unfortunatly its true about the voltage issues on USM-seriel adapters, I tend to use a seperate PSU for mine, my old battered Tait unit seems to do the basic devices ok, like you say, the more recent ones are going to need more sophisticated hardware, but I am sure the ham radio guys like us will overcome the problems, as none of us like to spend money! Best 73's

    ReplyDelete