View previous topic :: View next topic |
Author |
Message |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
What's wrong with this ICSP algorithm |
Posted: Fri Jun 02, 2006 4:37 am |
|
|
Hi,
MCU: 16F628
I am trying to make a programmer, using the serial port.
The programmer consists of three optical isolators that connect to the port. Two of the ports serve as clock and data lines, while the third is for the MCLR (program enable) pin.
There is also a 7805 regulator IC for the VDD voltages. The 13 Volts supply is derived from a zener diode.
I have developed a VB program that sets the pins CLOCK, DATA and MCLR zero, then MCLR is raised to 13 volts.
The programming method I use is as follows.
1. Load configuration command 0x0000
2. Increment address 7 times to get ox2007 address
3. Bulk erase setup1 is sent
4. Bulk erase setup 2 is sent
5. begin erase command is sent
6. Then bulk erase 1 and bulk erase2 is sent.
7. Bulk erase command is sent
8. Data 0x3FFF is sent
9. Bulk erase program memory is sent
10. Begin program only command is sent.
To program a word (14 bit ) the .....
1. Load data command
2. Output data (LSB first)
3. Begin program cycle.
4. Wait
5. Increment address.
To program the configuration data
1. Load configuration command
2. Increment address 7 times
3. Send the configuration word (LSB first)
When I try the MCU on the target board it doesn't work...
Kindly advise what is wrong.
thanks
arunb
Note:
1. The target hex file was compiled on MPLAB ver 6.2 using PCM compiler ver 3.1619.
2. I refered to the article 'PIC 16F62X EEPROM Memory Programming Specification' found on Microchip website. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Jun 02, 2006 9:14 am |
|
|
Quote: |
The programmer consists of three optical isolators that connect to the port.
|
The implementation to build a programmer is a well know technique well documented.
Just a guess, are you sure that including the optoisolator you keep the same phase?
I mean, if you are taking out data from the Emitter will be Ok, if you are taking out data
from the Collector, you are introducing an unwanted 180° phase shift that will revert
all your signals.
Humberto |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Fri Jun 02, 2006 9:40 pm |
|
|
Hi,
You are right a high on the Port will set the opto-isolator pin to low.
To keep the same phase I invert the states in the PC.
I have found the logic to be OK , according to the documentation, but I am still not able to program the 16F628 mcu.
Could there be any other problem ?
thanks
arunb |
|
|
|