Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can program AT89S51 only once

Status
Not open for further replies.

Somphorn

Member level 1
Joined
Sep 4, 2009
Messages
35
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Location
Johore, Malaysia
Activity points
0
Hi!

I hope whoever with the experience building this programmer can give me a few pointers.

I built (stripboarded) the programmer circuit as per

https://www.kmitl.ac.th/~kswichit/IspPgm30a/ISP-Pgm30a.html

and managed to read signature, and read program memory into buffer.

It can program a new AT89S51 chip, but only once. I programmed a few new, empty chips (running lights routine) and it worked when I put those chips into my breadboard circuit (seeing those lights running as I had intended made me feels like I've conquered Everest).

Now, I take the chip and put it back again into the programmer to download new (fancier) running lights routine. I can still read signature and read the program memory into buffer. But when I want to write for the second time, it fails. For one chip it's at 0000H. Other chip 0003H. It's not random. If a particular chip failed at, say, location 0002H it will always fail there. After this write fail, when I read the program memory into buffer all I can see is a mixture of old and new byte codes interfused with some seemingly random byte values. At least that's what it looks like to me.

I faithfully followed the schematic, with a few exceptions:
a) My +5V Vcc coming from computer PSU.
b) I used 10nF SMD 0603 (I ordered wrongly).

Sorry for the wall of text. I'm not an electronics student. Most of what I learned are from library text books and Internet. If I can't do this then I will probably stop this for a while and look for another hobby. Any kind of help/pointers is appreciated.
 

ctownsend

Advanced Member level 2
Joined
Nov 27, 2004
Messages
574
Helped
93
Reputation
188
Reaction score
63
Trophy points
1,308
Location
Canada
Activity points
3,659
Here is some advice: Get yourself a decent programmer.

It will save lots of headache and frustration in the long run. There are many problems that could be happening with your parallel port programmer anywhere from noisy lines to long cables to different voltage levels from the parallel port to the microcontroller. Every parallel port is different on every PC.

If you are a student, you probably don't need to spend the time to troubleshoot all these problems. A programmer that uses USB or the serial port would be the most reliable solution to get you going. (search google for 89S51 USB programmer, also search ebay) This way you can learn without the migrane headaches!!

Good Luck
 

    Somphorn

    Points: 2
    Helpful Answer Positive Rating

pranam77

Advanced Member level 5
Joined
Apr 22, 2008
Messages
2,786
Helped
552
Reputation
1,102
Reaction score
371
Trophy points
1,363
Location
INDIA
Activity points
16,418
Assembling on a bread board will always have its own problems. Go for a nice programmer which can program all the 89series. Cheers
 

    Somphorn

    Points: 2
    Helpful Answer Positive Rating

Somphorn

Member level 1
Joined
Sep 4, 2009
Messages
35
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Location
Johore, Malaysia
Activity points
0
That's my dilemma here.

Part of me said: I could wait a few months and buy a decent programmer from Farnell or whatever. There's no need to re-invent the wheel.

But at the same time, I thought: If I could learn more about many problems that could be happening with your parallel port programmer anywhere from noisy lines to long cables to different voltage levels from the parallel port to the microcontroller. then it would be more meaningful as the knowledge can be applied to many situations in the future.

Thanks for the input, ctownsend and pranam77.
 

ctownsend

Advanced Member level 2
Joined
Nov 27, 2004
Messages
574
Helped
93
Reputation
188
Reaction score
63
Trophy points
1,308
Location
Canada
Activity points
3,659
If you are determined to learn, you can read this webpage:
https://www.aplomb.nl/TechStuff/PPPD/PPPD English.html

This is directly related to the STK200 programmer for avr, however, the information is valuable in respect to building the most efficient programmer you can build.

The STK 200 programmer's pinout will not work with the software you have. It may/may not work with this software:

https://www.kmitl.ac.th/~kswichit/SPI_Pgm/SPI-Pgm37.html

I believe you can change the pinout to comply with your programmer with the 3.7 version.

The best one I have used (and most dependable) is this one:
https://dybkowski.net/elka/ispprog_en.html

If you have to use a parallel port programmer, I would lean towards the last on in the list. It supports the STK200 pinout or any pinout you choose.

If you can program in DOS, this one is reliable and easy to build. No components, just a 25 pin plug! Download aec_isp_v3.zip here:

Good Luck
 

    Somphorn

    Points: 2
    Helpful Answer Positive Rating

Somphorn

Member level 1
Joined
Sep 4, 2009
Messages
35
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Location
Johore, Malaysia
Activity points
0
Eureka! I used AEC_ISP programmer signal wiring method, added 74HCT541 as per SPI Flash Programmer, put capacitors on SCK line (as per https://www.aplomb dot nl/TechStuff/PPPD/PPPD English.html) and grounded the DB25 (a tip by Khizer Naeem, ikalogic dot com).

It works. But it was intermittent. There is still the problem of verify error during programming, but do it again a few times then it will finally get programmed and verified. I think this is due to incorrect capacitor being used. The author above used 470pF. I only have 33pF so I'm using that first.

Next step is to order a few shielded cables and correct value caps.

Special thanks to ctownsend.

Cheerios!!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top