Showing posts with label ICSP. Show all posts
Showing posts with label ICSP. Show all posts

Monday, May 23, 2011

PIC Programming using ICSP and ICPROG

IC-Prog is a free windows program that you can use for PIC Programming. It interfaces using either the serial or parallel port on a PC. You can download IC-Prog here. The following devices are currently supported IC-Prog software.

Microchip PIC devices:  
Spi Microcontrollers:  
Flash Microcontrollers:  
Philips Serial Microcontrollers:  
I2C eeproms:  
4-Wire eeproms:  
Spi eeproms:   
Microwire eeproms:  
Modern Serial eeproms:  
IM-Bus eeproms:  
Scenix/Ubicom devices : 


Setting up the IC-Prog environment
When we first start IC-Prog this is the screen we see for selecting the hardware for the PIC programmer; I have selected JDM programmer - a serial port programmer, Windows API - interface and leave rest of the settings same.

Press OK to continue. After this the main program screen is displayed.

How to select a device to program:
Device can be selected in two ways. Firstly, we can select our device (in my case it is 16f877a) from combobox located at top right side of the IC-Prog software window.

Secondly, goto to software menu and select Settings->Device->Microchip PIC->More->More->PIC 16f877a.

Now goto File->Open and select hex file to be uploaded (burned) in PIC 16f877a microcontroller. When opened file get loaded in IC-Prog buffer following action can be taken :

Program Device

The program device button does just that it programs the contents loaded from the hex file (in IC-Prog memory) into the program memory of the PIC micro. If there is any EEPROM in the chip then it programs this as well. Finally it programs the configuration word

Read Device
The read device button reads back the entire contents of the chip into the currently selected buffer (shown at the bottom of the ICPROG window). So you can save the hex file or compare it to the contents of another buffer.

Verify Device
The verify device button reads back the entire contents of the chip ensuring that it matches the hex file. Verification may automatically happen at the end.Once you get used to IC-Prog and your hardware works reliably you may only want to do a verify if something does not work otherwise it takes more time up.
Note: Depending on settings in menu (Settings->Options->Programming)

Erase Device

The next PIC programming action is to erase the device by hitting the erase device button. It sends a command to the PIC which erases the whole device including protection bits. So this command quickly erases the chip.

Note: You don't have to use the erase button as the program button will overwrite the chip contents anyway. It is sometimes useful if you want to convince yourself that the program is actually programmed into the device correctly.

Which are ICSP pins of microcontroller
As we know ICSP pins are used to upload hex file in microcontroller. Here are ICSP pins of some PIC microcontroller.

16f84

16f877

16f628

18f452

18f2550

Some Useful Videos
Watch following videos to setting up the JDM Programmer hardware settings in IC-Prog software and uploading hex file in microcontroller (in my case it is 16f877a).


IC-Prog Settings


Uploading hex file

Friday, May 20, 2011

[DIY]+[PIC Programmer]+[IC-Prog]

Introduction
There are many kinds of PIC programmers in market, most of these use the parallel port, a serial port (COM port), or the USB but they are very costly and hobbyist like me can not  buy such a costly programmer so i decided to make a cheap PIC programmer. Being a electronics hobbyist I believe in DIY (do it yourself) so here I glad to tell you that my programmer can be built easily. The programmer, which I built, does not need an external power supply it takes all necessary signals and power supply from RS232 serial port, and since there are only few parts, it is very cheap and easy to make. This PIC programmer is called "JDM programmer" and based on ICSP (In-Circuit Serial Programming) . This name comes from the name of Jens Dyekjar Madsen who devised this first. His homepage is here.


Advantage
  • This simple PIC Programmer will allow you to painlessly transfer hex programs to most Microchip PIC microcontrollers without sacrificing your budget and time
  • This PIC programmer  is very cheap due to only few common parts are used.  
  • It is in-circuit serial programmer so can be used to conveniently program PIC microcontrollers without removing them from the target circuit.   
  • It can be built in very short amount of time.
  • This PIC programmer is compatible with a popular IC-Prog software that shows you a status bar of the programming progress. 
How to build
Before you build this "PIC programmer", I recommend checking to see if there is enough output voltage at the serial port your personal computer. If TXD, DTR, and RTS do not have more than +7.5V(or -7.5V), this programmer will not work well, especially, with the latest laptop computers that using low power RS232 interface ICs. See follwing image to find TXD, DTR and RTS pins.
On the PIC side there are two possibilities to program the PIC microcontroller, socket and in-circuit. A socket programmer provides a way to connect just a bare PIC to the programmer and In-circuit programmers however connect to the PIC while it is connected to the target circuit. So ICSP allows programming of a PIC in circuit, avoiding the need to constantly take it in and out of the programmer and the subsequent bending of pins.


ICSP mode of programming 
In ICSP mode of programming PICs are programmed using 5 signals. The data is transferred using a two wire synchronous serial scheme, with the clock always controlled by the programmer. The ICSP signals are:  

GND:Negative power input to the PIC and the zero volts reference for the remaining signals. Voltages of the other signals are implicitly with respect to GND.
Vdd:This is the positive power input to the PIC. Some programmers require this to be provided by the circuit (circuit must be at least partially powered up), some programmers expect to drive this line themselves and require the circuit to be off, while others can be configured either way (like the Microchip ICD2). The Embed Inc programmers expect to drive the Vdd line themselves and require the target circuit to be off during programming.
Vpp:Programming mode voltage. This must be connected to the MCLR pin, or the Vpp pin of the optional ICSP port available on some large-pincount PICs. To put the PIC into programming mode, this line must be in a specified range that varies from PIC to PIC. For 5V PICs, this is always some amount above Vdd, and can be as high as 13.5V. The 3.3V only PICs like the 18FJ, 24H, and 33F series use a special signature to enter programming mode and Vpp is a digital signal that is either at ground or Vdd. There is no one Vpp voltage that is within the valid Vpp range of all PICs. In fact, the minimum required Vpp level for some PICs can damage other PICs.
PGC:Clock line of the serial data interface. This line swings from GND to Vdd and is always driven by the programmer. Data is transferred on the falling edge.
PGD:Serial data line. The serial interface is bi-directional, so this line can be driven by either the programmer or the PIC depending on the current operation. In either case this line swings from GND to Vdd. A bit is transferred on the falling edge of PGC. 

Here you can find schematic, board layout and component layout of the my "JDM programmer" which is  based on ICSP.
Schematic 
 Board Layout
 Component Layout

Download
You can find eagle schematic and board files in following image (see my another interesting post here to see hidden files).
2 Hidden Files
How to program with IC-Prog
Check my another post here in continuation with this post.