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.

[ARM] Interfacing of at25f1024 eeprom with lpc2129 microcontroller

Status
Not open for further replies.

v.s.n.kumar

Member level 1
Member level 1
Joined
Dec 2, 2013
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
303
Hi,
I have interfaced AT25F1024 SPI-EEPROM with LPC2129. The code is to write a single byte of character in to the AT25F1024 & again read the same byte & display on the lcd. I know how to display on the lcd. but i don't know how to write & read a byte from AT251014. I also followed the instructions present in the datasheet of AT25F1024. but the code is not working. can anybody tell how to write & read a byte from AT25F1024 by using LPC21XX.
 


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<LPC21XX.h>
#include"SPILCD.h"//LCD PROGRAMM 
#define slave2 1<<7 //CHIP SELECT PIN
int main(void)
{
 unsigned char dat,ch='A',gar;
 PLLCFG=(1<<2)|(1<<5);//SETTING THE CORE CLOCK AS 60MHZ & PCLK AS 15MHZ
 PLLCON=(1<<0)|(1<<1);// ENABLE THE PLL
 PLLFEED=0XAA;
 PLLFEED=0X55;
 IODIR0=slave2; // MAKING CHIP SELECT PIN IN LPC21XX AS OUTPUT PIN
 IOSET0=slave2; // SLAVE IS DEACTIVATED
 PINSEL0|=(1<<8)|(1<<10)|(1<<12);// MAKING THE PINS AS SCLK,MISO,MOSI
 S0SPCCR=5;// SPI BIT RATE IS 3MHZ
 S0SPCR|=(0<<3)|(0<<4)|(1<<5)|(0<<6);//CLK POLARITY & CLK PHASE AS 0, LPC21XX AS MASTER & MSB IS TRANSMITTED FIRST
 gar=S0SPSR;// CLEARING THE STATUS REGISTER
 IOCLR0=slave2; // SLAVE IS ACTIVATED
 S0SPDR=0X06;//WRITE MODE INSTRUCTION IN AT25F1024 EEPROM
 while((S0SPSR&(1<<7))==0);// MONITORING THE FLAG UNTIL THE LAST BIT IS TRANSMITED
 gar=S0SPSR;// CLEARING THE STATUS REGISTER
 S0SPDR=0X04;//DATA // DATA TO BE PUT IN THE AT251024 EEPROM
 while((S0SPSR&(1<<7))==0);// MONITORING THE FLAG UNTIL THE LAST BIT IS TRANSMITED
 gar=S0SPSR;// CLEARING THE STATUS REGISTER
 IOSET0=slave2;//SLAVE IS DEACTIVATED
 delay(100);// SOME DELAY
 IOCLR0=slave2; //SLAVE IS ACTIVATED
 S0SPDR=0X03;//READ MODE INSTRUCTION IN AT25F1024 EEPROM
 while((S0SPSR&(1<<7))==0);// MONITORING THE FLAG UNTIL THE LAST BIT IS TRANSMITED
 gar=S0SPSR;// CLEARING THE STATUS REGISTER
 S0SPDR=0X00;//DATA CONTAINED IN ADDRESS OF AT25F1024 EEPROM
 S0SPDR=0X00; 
 while((S0SPSR&(1<<7))==0);
 gar=S0SPSR;
 dat=S0SPDR;//THE DATA STORED IN EEPROM IS COPIED IN TO A VARIABLE
 IOSET0=slave2;// SLAVE IS DEACTIVATED
 INIT_LCD();
 if(dat==0x04)
  DAT_LCD('A');
 else
  DAT_LCD('B');
 while(1);
 
 
 
 
}

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top