AT91SAM7S64 problem with EFC

OP #1310954
Rate this post
• ▲ useful
▼ not useful
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*) &params);
}
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*) &params );
  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.
Attached files:

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.