CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

What's wrong with this ICSP algorithm

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

What's wrong with this ICSP algorithm
PostPosted: Fri Jun 02, 2006 4:37 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 02, 2006 9:14 am     Reply with quote

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

View user's profile Send private message Send e-mail

RE:
PostPosted: Fri Jun 02, 2006 9:40 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group