Continue to Site

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.

AT89S51,AT89S52 ISp programmer using ATMEL avrprog

Status
Not open for further replies.

ctownsend

Advanced Member level 2
Joined
Nov 27, 2004
Messages
575
Helped
93
Reputation
188
Reaction score
63
Trophy points
1,308
Location
Canada
Activity points
3,697
AT89S51,AT89S52 ISP programmer using ATMEL avrprog

This code programs AT89S51 and AT89S52 devices using Atmel's avrprog.exe when used with the included circuit. The circuit takes power from the target circuit (5Volts) and uses your PC's serial port. This programmer will work well with USB to RS232 cables or adapters if you have a good working cable (not a knockoff cable from China, these don't work consistently!)

Download avrprog.exe here:
AVR Freaks

If you have avrstudio installed, you can find avrprog.exe in the program folder.
(usually C:\Program Files\Atmel\AVR Tools\AvrProg)

Please refer to the included schematic diagrams. If you have an existing avr910 programmer board, you can use the same board, however you will have to modify the reset circuit for the 8051 on the programmer board, and install an 11.0592MHz crystal. (also be aware of the pin used for the LED, as some circuits may be different)

Use any 8051/8052 microcontroller for the programmer matching the pins on these 40 pin devices: AT89C51,AT89C52,AT89S51,AT89S52,AT89S53,AT89S8252,AT89S8253 or any other 40 pin 8051 device with the same pinout. Refer to the schematic titled "40pin_sch.gif".

You can also use the 20 pin 8051/8052 mcu's with this code including AT89C2051, AT89C4051, AT89S2051, AT89S4051.
if using a 20 pin mcu for the programmer, Refer to the schematic titled "20pin_sch.gif".

Limitations of this code when using ATMEL's avrprog.exe (because I cannot change the avrprog.exe code)

1. When using this code, avrprog.exe will not give you a choice to select a different device. The selected device will be greyed out and will show up as AT89S53. (this is the closest device to AT89S51/52 that avrprog.exe supports as it does not have an eeprom)

2. When locking the device, all lock bits will be programmed (mode 4) regardless of the setting in avrprog.exe.

3. Because avrprog.exe thinks the target is an AT89S53, when reading the flash you will get a 12K file, even if the device you are reading is 4K (as in the AT89S51) or 8K (as in the AT89S52). You can adjust the output hex files accordingly by deleting the extra data manually in notepad. Delete everything starting on this line to the end of the file for 4K devices (AT89S51) :100FF000 and delete everything starting on this line to the end of the file for 8K devices (AT89S52) :10200000.
Be sure you have ":00000001FF" at the end of the file!

At the same time if you try to program a larger hex file than your device will accept, (i.e. a 12K file into a 4K device, the program will not show an error message) The program will probably give you a verify error.

It is up to you to manage your hex files according to the size of the device you are using.

I have been using this programmer for a long time without any problems. It works very reliably.

Looking for a reliable ISP programmer but don't like avrprog.exe? look at this thread here:
https://www.edaboard.com/threads/180513/

post all questions here, please don't message me.

regards,
ctownsend
 

Attachments

  • 910-89S.zip
    43.5 KB · Views: 359
Last edited:

yes frens don't use fake cables from china it will give you lots of trouble try to build yourself .the one 89s51/52 using serial or usb port has nothing problem this is verified by me .i hope this will work .
one question
can we lock chips ?
can we program avr chips also ? like atmega32,atmega8 etc
 
Last edited:

can we lock chips ?

yes it's in the documentation above (mode 4 only) all lockbits will be programmed no matter what.

can we program avr chips also ? like atmega32,atmega8 etc

no, as mentioned above only 89S51/89S52 with this version.

I did another version that does some avr (whatever avrprog will support). I have not completed the code nor have I bug tested it yet. The code is not 8051, it is avr.
 
little confusion here
Because avrprog.exe thinks the target is an AT89S53, when reading the flash you will get a 12K file, even if the device you are reading is 4K (as in the AT89S51) or 8K (as in the AT89S52). You can adjust the output hex files accordingly by deleting the extra data manually in notepad. Delete everything starting on this line to the end of the file for 4K devices (AT89S51) :100FF000 and delete everything starting on this line to the end of the file for 8K devices (AT89S52) :10200000.
Be sure you have ":00000001FF" at the end of the file!
 

little confusion here
Because avrprog.exe thinks the target is an AT89S53, when reading the flash you will get a 12K file, even if the device you are reading is 4K (as in the AT89S51) or 8K (as in the AT89S52). You can adjust the output hex files accordingly by deleting the extra data manually in notepad. Delete everything starting on this line to the end of the file for 4K devices (AT89S51) :100FF000 and delete everything starting on this line to the end of the file for 8K devices (AT89S52) :10200000.
Be sure you have ":00000001FF" at the end of the file!

the only way to make the avrprog.exe work with 89S51/89S52 was to use a device that is programmed in a similar manner. All of the avr devices are programmed in words which won't work for 8051's which are programmed in bytes. The only 8051 devices that avrprog supports are 89S53 and 89S8252. Because 89S8252 has an internal eeprom, I disabled it in the device list and went with 89S53.

When asked to send the device list, the programmer only sends avrprog.exe the device code for 89S53. This is why the programmer thinks the device is an 89S53. It is also why you don't have a choice to select other devices, as there is only one device supported, that being 89S53.

Avrprog.exe then sends the hex file to the programmer in byte format as opposed to word format as with avr devices.

Because the programmer sees the device as an 89S53 (12K flash), when the user selects the read flash command, you will get a 12K flash file (even though the addresses beyond the limits of the flash you are reading will be invalid data) No problem, it can be fixed if you delete the extra data as mentioned above.

I used this programmer successfully with a new pc & windows vista when I had no choice but to run vista before I pulled all my hair out and found drivers for XP. This programmer also works good with USB to RS232 cables.
 
Last edited:

I am using 89c51 as the programmer (master) and 89s52 as slave processor IC with the software AVRprog.exe. While I was trying to programme the following small hex file, the software was giving a warning message like,

Address: 0x003f, Expected: 0xd2, Received: 0xff

The hex file is,

:03000000020030CB
:1000300074FFF590F5B0759850758DFD758920D2D7
:100040008E12005512004D12005D80F522F5993098
:1000500099FDC299223098FDC298E5992220910716
:100060007590FFC29280162092077590FFC2938010
:0E0070000C2093077590FFC2918002C291226E
:00000001FF

What may be the reason? Please help.
 

I am using 89c51 as the programmer (master) and 89s52 as slave processor IC with the software AVRprog.exe. While I was trying to programme the following small hex file, the software was giving a warning message like,

Address: 0x003f, Expected: 0xd2, Received: 0xff

That is a verify error. Check your wiring. I use this setup all the time it works good. If you are using a cheap USBtoRS232 cable I will bet that is the problem right there.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top