Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic to Pic programmer all works except CHIP ERASE command (16F87XA) why?

Status
Not open for further replies.

karaapak

New Member
In short: I am building a programmer as a school project, I am using 16F877A to program another 16F877A, I am using assembly language, I can program erased chips but I cannot program code or data protected chips because I couldn't achive to CHIP ERASE command worked. Do anyone know why this problem is happening?

DETAILED:

Hi, firstly I want to apologise for my bad english I wish I can explain my problem. I can not erase Pic16F877A configuration memory with using mine programmer, I am building a programmer for only programming Pic16F877A chip and only one program (as a beginning), this is a school project. I am using one chip to program another chip, as a project I have to use a pic to program another pic. I have achiaved these goals;
I can program chip when it is not code and data protected,
I can erase a pic when it is not code and data protected with bulk erase program memory command ( from this I am assure that my Vdd range is between 4.5V<Vdd<5.5V .
But I can not use chip erase command to erase a chip that have data or program memory or both of them protected, http://piclist.org/techref/postbot.asp?by=thread&id=Silicon&w=body&tgt=post subject:'[PIC] 16F87xA silicon bug (programming)' ) they says "wrote-load 3FFFh to data latches before chip erase command, howewer programming specification says this step does not required" I tried also this but I could not achive to program code or data, or code and data protected Pic16F877A chip, I think there is something wrong or not well described in the 16F87XA Flash Memory Programming Specification (39589C) or I am missing something. I want your help or advice to solve my problem any help will be appreciated. I spend a week and tried at least 200 variations of my program algorithm to to be able to use chip erase command but always I failed. I think I will loose my mind if I could not find a way to solve this problem.
My program algorithm to erase a code or data or code and data protected 16F877A chip is this
set VDD=5.00 V ;I am entering programming mode (HV programming)
set Vpp=13.0 V ;when I am doing these SCLK and SDATA also RB3 (PGM) are at the 0 V level
load data for program memory ;(I tried either 0000h and 3FFFh as a payload but the two of them did not worked) ( I tried to write 8 data latches with these two values but this is either did not worked)
Load configuration (000000) command (set pc 2000h) with data payload 3FFFh (ı have also tried without Load configuration command this is also not worked)
CHIP ERASE command ; I send 1Fh to the chip
wait 8 milisecond ( I also waited as long as one second but didn't worked)

set Vpp=0V
set VDD=0V ; after one mikrosecond from Vpp=0 , VDD became 0V so I am getting out of to programming mode

after these I am reentering the HV programming mode and writing the firstly configuration memory and then program memory ( I tried first writing program memory and then configuration word and ID words it does not matter two of them worked well with unprotected chip.
 
But electrical specification does not allow Vpp higher than 13.5 V. Does not 13.6v to 14v cause any problem, I have already lost one one my pic due to the misvoltage.
 
But electrical specification does not allow Vpp higher than 13.5 V. Does not 13.6v to 14v cause any problem, I have already lost one one my pic due to the misvoltage.

hi,
Do not use voltages higher than those specified in the datasheet.

Measure your voltage supplies while you are trying to program and erase the PIC, your voltages maybe falling when on load.
 
I measure the voltages but because of programming algorithm is happening very fast I can not be sure about measurements, I have tried modifying program algorithm to slow motion for example I have apply 1 second vpp and vdd programming voltages and I have measured in these conditions under these circumstances there is no problem about voltages but nowadays I am thinking about there could be a problem about current I will try to explain it; in one of my first trial I was using 7805 to supply 5 volt to my circuit and I was using one of my 12 V 1 A adaptor as a power source but when I use these I damaged the pic I think it had happen because of high current but it is not suppose to be because of the high input empedance of the Vdd and Vpp pins so then I am using 100 ohm resistor between 7805 's input pin and adaptor this can supply 100 mA to my circuit could it be the source of the chip erase command s not working, and there is any different needs between bulk erase and chip erase because like I said I can bulk erase the program memory when it is not protected but I can't use chip erase.
 
hi,
Look at page #11 of this application pdf.

I know its not for the 16F877 PIC, but the principle is the same.

EDIT:
Added the 16F877 programming Spec. look at page #8
 
Last edited:
if you wanna show "All Bulk Erase operations must take place with VDD between 4.5-5.5V." there is only thing about power supply, and also "Flash Memory Programming Specification 39589C" 16f877A 's programming specification says same thing so I learn how I can build a programmer from this specification so my programmer based upon what they wrote to there but there is nothing about current consumption when the pic is programming mod. My question was İs 100 mA enough for two pic when They were using as I said also I have drow a schematic to show my connections ( I didn't show only the 100 ohm resistor in front of the 7805 which I said before. https://s2.dosya.tc/server17/HfALgB/showprogrammer.DSN.html
 
Yes I have read page 8 more than 50 times and I have tried what it says more than 100 times but it did not make my programmer worked. as I said in my first message programming specification is wrong or missing this is not my conclusion other programmers says also this http://piclist.org/techref/postbot.a...=body&tgt=post also I wrote this in my first message, I want to added this I don't have any problem about undestanding the programming specification, I don't think the programming specification may solve my problem I need extra information, I think there is something not well described or missing about chip erase algorithm in the specs.
 
Last edited:
hi,
I downloaded your drawing, but I cannot open it.

Your 7805 +5V supply circuit should not require a 100R on the input.

The PIC's will only draw the current they require from the 7805, so if you are damaging your PIC's there must be a problem in your Erase cycle times or the circuit.

Can you post a circuit diagram to your posts here.??
Use the 'Go Advanced' button and then 'Manage Attachments' button and select the circuit file on your PC and Upload it

E.
 
okey it gives error when I am trying to added it as a isis file says not supported and I converted it jpg than added it to my post.
 
https://s2.dosya.tc/server17/Ri5Gg1/showprogrammer.PWI.html ;isis file
https://s2.dosya.tc/server17/oXpEI2/LastLoadedshowprogrammer.DBK.html ;isis file
https://s2.dosya.tc/server17/HfALgB/showprogrammer.DSN.html ;isis file
https://s2.dosya.tc/server17/ZrTzxL/programmer.HEX.html ;my programmer pics hex complied with mplab
https://s2.dosya.tc/server17/kq4iLI/programmed.hex.html ;when I programmed pic with my programmer pic I am reading back this hex this is working
https://s2.dosya.tc/server17/ONqBLz/_5vto_12vconverter.mht.html ;13v vpp generator
https://s2.dosya.tc/server17/fpzShW/programmer.asm.html ;asm file
I didn't added all isis files maybe because of this it is not worked if you want you may try with all isis files, in addition to this I added all my codes in asm.
 
Sır ericgibbs I wanna specially thank you for your great help, Finally I found the problem about Chip Erase and my circuit yes there is a problem about programming specification of 16F87XA chip erase sequence but in addition to this like you and others said there coluld be a problem about voltage supply ( measure the voltages vhen programming advised) I have solve the problem just a little capacitor, yes there was a unmeasurable voltage falling when I am trying to execute chip erase sequence the capacitor which I simply added to power rail to ground (10 uF) saved all about the requirement and NOW CHIP ERASE IS PERFECTLY WORKING. The working sequence like this;

CHIP_ERASE_1 NOP ;if you want chip erase you may call this label in main program
ENTER_HV_PROG ;PC=0000H ; first Vdd=5v then Vpp=13 V
LOADCONFIG ;PC=2000H send load config command
WRITE3FFF ;write 3FFF as a data payload
LOAD_PROG_MEM ;issue load program memory command
WRITE3FFF ;write 3FFF as a data payload
CHIP_ERASE ;send 01 1111 (1Fh) chip erase command
CALL DELAY30MS ;wait for chip erase to execute
END_PROG ;send end programming command
EXIT_HV_PROG ;set Vpp=0 then Vdd=0 to exit from programming mode or reset to chip to continue writing or verifying to memory

RETURN
 
hi,
Thanks for letting us know.;)

It would help other builders who are having problems if you could post the details of the project.

E.
 
https://s2.dosya.tc/server17/oXpEI2/L...ammer.DBK.html ;isis file
https://s2.dosya.tc/server17/HfALgB/s...ammer.DSN.html ;isis file
https://s2.dosya.tc/server17/ZrTzxL/programmer.HEX.html ;my programmer pics hex complied with mplab
https://s2.dosya.tc/server17/kq4iLI/programmed.hex.html ;when I programmed pic with my programmer pic I am reading back this hex this is working
https://s2.dosya.tc/server17/ONqBLz/_...erter.mht.html ;13v vpp generator
https://s2.dosya.tc/server17/fpzShW/programmer.asm.html ;asm file
I didn't added all isis files maybe because of this it is not worked if you want you may try with all isis files, in addition to this I added all my codes in asm.

when I said "I didn't added all isis files " I mean the post before this one, the one which has only one link, that you didn't opened, I said my english is not good. All my program codes and schematic of my circuit are in these links, and I have said the how to solve problem, and when we are discussing we show the way to how to make a programmer I think these will be very helpfull for builders.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top