Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > Embedded > LPC2138 Flash W...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 12423 of 13381
Post > Topic >>

LPC2138 Flash Write Problem

by "bm_seo" <brian.murphy.seo@[EMAIL PROTECTED] > Jun 25, 2008 at 06:22 AM

(Apologies if posted twice, couldn't find message)

I am trying to get Flash write working on LPC2138 with no sucess.
Code is below. Any help appriciated.

typedef void (*IAP)(unsigned int [],unsigned int []);
IAP iap_bypointer;
void iap_byfunction (unsigned *cmd,unsigned *rslt,unsigned entry);

unsigned int command[5];
unsigned int result[5];
char Ram_Arry[512] = "Hello World";
char *Ram_Pointer;

void flash_write(void)
{
unsigned char index;

iap_bypointer = (IAP) 0x7FFFFFF1;			//set IAP entry address in function
pointer

//Ram_Pointer = &Ram_Arry[0];
Ram_Pointer = 0x40005000;

for (index = 0; index<0x0B; index++)		//Copy data to be written to flash
into the RAM
{
	*Ram_Pointer = Ram_Arry[index];
	Ram_Pointer++;
}
//Ram_Pointer = &Ram_Arry[0];

command[0] = 0x36; 	//command code for "Read part ID"
iap_bypointer(command,result);

command[0] = 50;	//Prepare sector ten for a write operayion
command[1] = 10;
command[2] = 10;
iap_bypointer(command,result);

command[0] = 52;  //erase sector ten
command[1] = 10;
command[2] = 10;
command[3] = 60000;  //Cclk == 60Mhz Pll is disabled in startup code
iap_bypointer(command,result);

command[0] = 50;  //Prepare sector ten for a write operayion
command[1] = 10;
command[2] = 10;
iap_bypointer(command,result);

command[0] = 51;          //write 512 bytes from address 0x40005000
command[1] = 0x00018000;  //to 0x00018000 in flash memory;
command[2] = 0x40005000;
command[3] = 512;
command[4] = 60000;						   

while(1)
{
;
}

}
 




 3 Posts in Topic:
LPC2138 Flash Write Problem
"bm_seo" <br  2008-06-25 06:22:56 
Re: LPC2138 Flash Write Problem
"Boudewijn Dijkstra&  2008-06-25 14:36:57 
Re: LPC2138 Flash Write Problem
Mike Harrison <mike@[E  2008-06-26 16:01:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 16:45:54 CST 2008.