Hi , I want to writing flash memory data for lpc2368 mcu. Then read flash memory adress , send to uart but the data coming ff
Please help
#include <lpc23xx.h>
#include "uart.h"
#include "irq.h"
#include "timer.h"
#include "protocol.h"
#define IAP_LOCATION 0x7FFFFFF1
char Ram_Array[] = "abcdefgh";
unsigned long command[5]; // For Command Table
unsigned long result[2]; // For Result Table
typedef void (*IAP)(unsigned long [], unsigned long []);
IAP iap_entry;
void Write_to_Flash()
{
//******************************************
command[0] = 50;
command[1] = 0x00007000;
command[2] = 0x00008000;
command[3] = 48000; // PCLK == 48000 KHz
iap_entry(command,result);
//******************************************
command[0] = 51;
command[1] = 0x40000100;
command[2] = 0x00007000;
command[3] = 256;
command[4] = 48000; // PCLK == 48000 KHz
iap_entry(command,result);
//******************************************
command[0] = 50;
command[1] = 0x00007000;
command[2] = 0x00008000;
command[3] = 48000; // PCLK == 48000 KHz
iap_entry(command,result);
//******************************************
command[0] = 52;
command[1] = 0x00007000;
command[2] = 0x00008000;
command[3] = 48000; // PCLK == 48000 KHz
iap_entry(command,result);
//******************************************
}
void
u1_karakter_gonder (unsigned char ch){
while (!(U0LSR & 0x20));
U0THR=ch;
}
void
u1_string_gonder(const char *ch){
while(*ch) //
u1_karakter_gonder(*ch++);
}
int main(void)
{
unsigned long i;
char *Ram_Pointer;
char *Flash_Pointer;
UART0Init(57600);
Ram_Pointer = (char*)0x40000100; // Set pointer to RAM
Flash_Pointer = (char*)0x00007000; // Set pointer to RAM
iap_entry = (IAP)IAP_LOCATION;// Set Function Pointer
for (i=0;i<256;i++)
{if(i<=8) {*Ram_Pointer = Ram_Array[i];}
else {*Ram_Pointer = '1';}
Ram_Pointer++;}
//Ram_Pointer=&Ram_Array[0];
Write_to_Flash();
u1_string_gonder(Ram_Pointer);
u1_string_gonder(Flash_Pointer);
while(1);
}