Using flash for data storage?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I need quite a bit of room to store data, and was wondering if the flash can be used to store it. (I'd rather not have to worry about external memory due to power considerations)

Any help appreciated.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been trying to do the same thing. I am trying to store my lookup table in flash

#pragma memory=constseg(TABLE)

char Lookup_table[][16] = {
"Fault Condition ",
"Current Status ",
"Three Ph Current",
"Motor Class ",

etc...

};

#pragma memory = default

If I access the memory directly, I can get it.
But if I try to pass the data to a function it looks in the sram.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
We use the Atmel dataFLASH..a SPI communicating part drawing almost no power which mates easily with the AVR. See
http://www.atmel.com and go to FLASH memory.

We use it on a number of boards...have a look at:

http://www.jedmicro.com.au/avr.htm

The 8 pin soic data flash is just above the numbers 580 in the photo. They go from 1 mbit to 32 mbit.

Cheers
Ed

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all:

In my current (Mega103) project I have about 48k of constant bitmap data stored in flash. And I access it just as if it were in normal ram. I use ImageCraft's C compiler, where this is accomplished with the simple "const" keyword when the variable is declared.

If your compiler does not support it, you could always write some assembly routines to write and read the flash data using the SPM/ESPM and LPM/ELPM instructions.

Regards,
Clark

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

>If I access the memory directly, I can get it.
>But if I try to pass the data to a function it looks in the sram.

Your function have a wrong prototype. It should have a right declared parameter to put "variable" "Lookup_table". Just add "flash" befor the type of that function parametr.

Example

void look_func(flash char * Table, int second_param, , , ) {
.....
.....

}

to call the look_func()

look_func(Lookup_table, xx, yy, , );

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hmmm... I use avr-gcc and the 'const' keyword does it for me. Never knew that this could really be an issue... RTFM time ;)

as always, taking the granted for being obvious

admin's test signature