AT8052 Interface to M25PE80(serial flash memory) problem.

Status
Not open for further replies.

EdwinTan

Newbie level 1
Joined
Dec 8, 2005
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
at8052

hi, guy.
i facing a problem with the M25PE80(serial flash memory using SPI). I cannt erase the data inside the M25PE80. i dunno whether is my programming problem or my schematic problem. BUT I can write and read from the M25PE80 but cannot erase data... this make me cannot rewrite the data.. I am using the assembly to program the AT8052 to interface the M25PE80.
Below was my Erase module code, hope u all can help me check it out the problem.

Code:
WRITE_EN:		
	MOV	A,#06H              ;instruction for WRITE EN
	MOV	BITCNT,#08H         ;send 1 bytes at once
	CLR	CS	               ;enable the M25PE80 through /CS
	CLR	C
SEND_WREN_CODE:	
	CLR   SCL
	RLC   A
	MOV   SDA,C
	NOP
	SETB   SCL
	NOP
	DJNZ   BITCNT,SEND_WREN_DATA
	SETB   WC1	               ;indicated the M25PE80 start          
	                           ;process the data after all data were 
                              ;done		
	CALL	DLY1MS
	
PAGE_ERASE:
	
	MOV	A,#0DBH               ;instruction for PAGE ERASE
	MOV	R0,#RAM_EE1     ;contain 3 BYTES address for start erase
	MOV	BYTECNT,#03H   
	MOV	BITCNT,#08H      ;send 1 bytes at once
	CLR 	CS                      ;enable the M25PE80 through /CS
	CLR	C
	
	
SEND_PE_CODE:
	CLR	SCL                      ;CLK OF M25PE80    
	RLC	A
	MOV 	SDA,C                   ;DATA OF M25PE80
	NOP	
	SETB	SCL
	NOP
	DJNZ	BITCNT,SEND_PE_CODE
SEND_PE__ADDRESS:	
	MOV	A,@R0
	MOV	BITCNT,#08H
	
SEND_PE_ADDRESS_LOOP:	
	CLR	SCL	
	RLC	A
	MOV	SDA,C
	NOP
	SETB	SCL
	NOP
	DJNZ	BITCNT,SEND_PE_ADDRESS_LOOP1
	INC	R0
	DJNZ	BYTECNT,SEND_PE_ADDRESS
	NOP
	NOP
	SETB	CS                          ;indicated the M25PE80 start          
	                                              ;process the data after all data were 
                                                              ;done
	CALL	DLY10MS                 
	CALL	DLY1MS
	RET

u can download the M25PE80 from the ST as below
[url]https://www.st.com/stonline/products/literature/ds/11517/m25pe80.pdf
[/url]

THKS for ur help...
 

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…