AT89s51 programming help

Status
Not open for further replies.

vijayragavalu

Member level 1
Joined
Aug 29, 2005
Messages
36
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,558
at89s51 programming

hi
i would like to make own programmer for at89s51/52/53 and avr.In this serial Programming(ISP) mode i am not able read the memory,when i send read commands(as per document doc2487-command is 0x20,0x00,0x00--- 0th memory) after program enable(cmd is 0xAC,0x53,0x00, and get back 0x69).

what actualy i am getting when i read the memory is

when i read 0th memory i get back 0x00
1st memory -- 0x01
2nd memory -- 0x02
3rd memory -- 0x03
.
.
.
0xFDth memory ---0xFD
0xFEth memory --- 0xFE
0xFFth memory --- 0xFF

but my Erase cycle is working fine(when i send erase cmd 0xAC,0x80,0x00,0x00)

i dont know what is the problem please rectify it

thanks in advance
 

at89s51 serial programming



How are you sending the commands? Are you using a microcontroller or the PC's parallel port??

I did this same thing with another 89S51, connected to a terminal program.

vijayragavalu said:
when i read 0th memory i get back 0x00
1st memory -- 0x01
2nd memory -- 0x02
3rd memory -- 0x03

are you sure the chip is not locked? The address is usually returned when you read a locked device. If you have verified that the enter programming command is working, and the erase command is working, I suggest you try to read the signature bytes.

Another problem I had at the beginning was the delay before the sck pulse (see below).

(this info can also be found in the datasheet page 20)
"SCK should be no faster than 1/16 of the system clock at XTAL1."

Code:
TX_SPI:
; Shift out a byte, most significant bit first.
; Shift in a byte, most significant bit first.
; SCK expected low on entry. Return with SCK low.
; Called with data to send in ACC.
; Returned with received data byte in ACC.

	mov r7, #8 			; bit counter

TX_SPI_Loop:
	mov c,MISO 			; input bit
	rlc a 			              ; move bit into CY
	mov MOSI,c 			; output bit
	
; add delay here 
;
	setb SCK 			; raise clock
;
; add delay here 
	
	clr SCK 			; drop clock
	djnz r7,TX_SPI_Loop 	; next bit
	ret
;*******************************************************************

hope it helps.
 
at89s51 isp programmer

hi ctownsend
Thanks for your reply. and i am using atmega8535 ic to program at89s51.i read brand new ic but i failed to get answer(answer should be 0xFF but i get back address).in that datasheet i have small Confusion.signature byte can be read by the command--->0x28,xxxx A11 A10 A9 A8 , A7xxx xxx0, read back Signature byte.. can you explain the commands(what is value of A11 to A7) .

please help me out
 

programming at89s51

vijayragavalu said:
hi ctownsend
can you explain the commands(what is value of A11 to A7) .
please help me out

I know the atmel datasheet is extremely difficult to understand for this particular command. I did this a very long time ago and I don't remember how I actually figured it out, but I DID get it to work.

A11 to A7 is the address high byte of the signature byte.
I think that is the problem you are having.

the commands would be:

28 20 00 XX < (1st sig byte read)
28 21 00 XX < (2nd sig byte read)
28 22 00 XX < (3rd sig byte read)

I also did the same thing (ISP programmer) using an avr 90S2313.
Works on both 89S51 and 89S52.

I sent you my AVR source code in a Private message. If you are still in doubt, check one of the latest avr910 source codes for the avr ISP programmer.
I think some of the latest source supports 89S51. I really don't remember since it was a very long time ago that I did this.

Good Luck
 
serial programmer at89s51

hi ctownsend

still i am getting same error(getting back the address) when i read signature byte

i have sent the code in private message box please check out and tell me what is error in it

thanks in advance
 

how to programing at89s51

Hi ctownsend
Now the C code is working fine.and your asm code was very usefull to develop my c code thanks a lot.
 

at89s51 programming code

It would be nice, if you would tell us what was wrong, so that others might avoid a potential pitfall.

JW
 

at89s51 programming c

well
i made wrong SCK clock frequency in my c code.in avr studio4 compiler i simulate for 4 mhz but my hardware i tried it in 8 mhz with 4mhz code mistakenly. that was my major problem.
Some hardware issues that is i didnt make EA logic high while i program it sothat only i get back what i send to it. now all mistakes were rectified. that's it
 

delay programs in at89s51 microcontroller

For reading data you should load a small program in the programmer which can interact with your PC request.
 

programming at89s51

no need. but i have not done direct reading of data from 8051 to PC. i have another(AVR) microcontroller to Write/read the target (8051) microcontroller.
 

how to programing at89s51 microcontroller

sir,
i want interfacing of microcontroller (AT89C2051)with ic Mt8870
 

isp programmer at89s51 how to

Hi asks
Sorry for delay still u want 8870 Dtmf decoder interface, come to personal Message. their i will send u the circuit
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…