Hi
I want to write data to embedded flash and later read it, but when I
read I get always 0xFFFFFFFF. I use functions for SAM7S256 (for this
microcontroller everything works OK) with some changes: in file
AT91SAM7S256.h - MEMORY MAPPING DEFINITIONS and in
demo_at91sam7_blink_flash.cmd. Maybe I have to make more changes, but I
don't know.
I use following functions to read/write data:
int saveParameters()
{
unsigned int params[32];
params[0] = slaveAddress;
params[1] = startAddress;
int i = 0;
for (i = 0; i < 12; i++)
params[2+i] = registers[i];
unsigned int lastPage = (unsigned int) (AT91C_IFLASH +
AT91C_IFLASH_SIZE - 128);
return AT91F_Flash_Write(lastPage, 128 , (unsigned int*) ¶ms);
}
void loadParameters()
{
int i = 0;
unsigned int params[32];
unsigned int lastPage = (unsigned int) (AT91C_IFLASH +
AT91C_IFLASH_SIZE - 128);
AT91F_Flash_Read(lastPage, 32, (unsigned int*) ¶ms );
for (i = 0; i < 32; i++)
{
dbgu_putc(params[i]>>24);
dbgu_putc(params[i]>>16);
dbgu_putc(params[i]>>8);
dbgu_putc(params[i]);
}
slaveAddress = params[0];
startAddress = params[1];
for (i = 0; i < 12; i++)
registers[i] = params[2+i];
}
There are files, I using, in attachment. I use YAGARTO with openOCD.
Please for help. Thanks in Advance.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.