EmbDev.net

Forum: ARM programming with GCC/GNU tools AT91SAM7S64 problem with EFC


Author: Marcin Domaszewicz (marcind)
Posted on:
Attached files:

Rate this post
0 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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.