Electronic – Why VPP isn’t 12V with safe resistor when a working microcontroller is inserted into this circuit

microcontrollerprogrammingresistorsvoltage

I tested the whole functionality of my programmer circuit, and many things work, but some things don't.

It seems to erase the entire contents of an AT89C4051, but it does not successfully program the chip. In fact, it seems nothing is programmed at all.

This is the pseudocode I use for the programmer:

Clear data (Set address 378h to 0)
Reset counter and enable program mode and wait 100us (Set Control 37Ah to 6)
** At this point, Pin 1=0V which is expected
Raise VPP (Set Control 37Ah to 2)    
** Expected 12V at pin 1 but only got 6.8V. Why? I don't know
Raise Step Reset (Set Control 37Ah to 3)    
Wait until system ready
Add 10mS delay
Lower Step Reset (Set Control 37Ah to 2)    
Wait until system ready
Reset count / lower VPP (Set Control 37Ah to 6)    

And for each byte:

Set data (Set Control 378h to data)    
Wait 100uS
Raise Step Reset (Set Control 37Ah to 1)    
Wait until system ready
Wait 2mS    
lower Step Reset (Set Control 37Ah to 0)    
Wait until system ready
Repeat for remaining bytes

For reference, "raise step reset" means the 4017 IC pin is set to high and "lower step reset" means make reset pin low. Once it falls low, the programming enable will stay low for at least 1/2 the time defined by the 555 timer circuit then it will be raised then after the clock is pulsed then the system will be ready.

Just about everything works but there is

ONE MAJOR ISSUE

When I instructed the system to raise the VPP voltage, it does, but in a weird fashion.

The resistor I use between 12VDC and RST of the micro is 100K only because Atmel's datasheet states that the maximum programming current is 250uA. So by using 100K, I'm using 12VDC/100K=120uA.

So with no microcontroller connected, the operation is accurate. The meter shows very close to 12V. However, when I took a working microcontroller out of a working system and I inserted it into this circuit and measured the voltage after performing the exact same operations, I only get between 6 and 7V.

I looked at other circuits and I haven't seen others use 100K resistors as pull-ups. In fact, I found the pull-up resistor is only 2.7K in the following circuit at: http://www.oocities.org/dinceraydin/8051/index.html

blowit-programmer

My question is why would such a small resistor be used for programming when the manual clearly states that there is an upper limit to the current that can be provided for VPP?

Am I supposed to violate that spec to make the programmer work?

And for reference, this is my circuit:
and the diagonal line in the middle is part of an arrow, not wire.
circuit

UPDATE

I searched the Internet and found ANOTHER programmer circuit that uses a LOW VPP resistor (1K).

URL is here: http://students.uta.edu/rx/rxr5243/projects/prog/

Image is here: http://students.uta.edu/rx/rxr5243/projects/prog/schematic.gif

Best Answer

If the current through the resistor is 120uA, the voltage across is will be 12V, meaning that you'll actually get 12V-12V=0V at the pin. That upper limit is a limit on what the microcontroller will draw, not a limit on what should be supplied.

What's happening is that the microcontroller is only drawing 60uA or so, but the resistor is dropping 60uA*100K=6V, so the output voltage is 12V-6V=6V. You need a much smaller pull-up resistor, so that the maximum programming current doesn't affect the output voltage much.

If you use a 2.7K resistor, for example, at 250uA the voltage at the pin will be 12-(250uA*2.7k)=11.325V, which is acceptable.

edit: actually, according to the datasheet, it needs to be at least 11.5V. A 2.7K resistor will (almost certainly) work, but technically it should be (12-11.5)/250uA=2Kohm maximum.