Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Is it possible to store data in unused code flash?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Fri Jun 10, 2005 4:09 am    Post subject: Reply with quote

Describe "data" storage?

Your program area (flash) can hold all sorts of data... it just has to be written into your program at compile time. Things like strings (days of the week, months of the year), a lookup table for CRC calculations... this is all data.

The ability to write to the program area after programming could produce the possibility of "self-modifying" code (which would be a no-no in most situations). This is why your program, once flashed into the device, is commonly referred to as "firmware"... it's supposed to stay the way you wrote it. Also, the program area (flash) has an endurance of 10,000 write/erase cycles. I'd say this is ok for even the most mistake prone programmer but using that area for changing variable data during run-time could burn a chip out quick.

You do have 4K Bytes of EEPROM in the M128 that you can use for data storage during run-time... are you needing more than that? The endurance of the EEPROM area is 100,000 write/erase cycles. One wouldn't want to store constantly changing values there but things like a weekly sprinkler schedule or lighting schedule (things modifiable but not changed often). Perhaps as a data logger (as long as 4K was big enough)... these uses could be most appropriate for that storage.
Back to top
View user's profile Yahoo Messenger
Brian

Bascom Member



Joined: 29 Jul 2004
Posts: 27

PostPosted: Fri Jun 10, 2005 7:45 am    Post subject: Reply with quote

The code flash has a lifetime of only 10,000 write/erase cycles.
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Jun 10, 2005 8:44 am    Post subject: Reply with quote

The Flash memory is written in a page-by-page fashion.
The write is carried out by storing data for an entire page
into a temporary page buffer prior to writing the Flash.

AVR106: C functions for reading and writing to Flash memory.
http://www.atmel.com/dyn/resources/prod_documents/doc2575.pdf

AVR105: Power Efficient High Endurance Parameter Storage in Flash Memory.
http://www.atmel.com/dyn/resources/prod_documents/doc2546.pdf

AVR109: Self Programming.
http://www.atmel.com/dyn/resources/prod_documents/doc1644.pdf
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 923
Location: France

france.gif
PostPosted: Fri Jun 10, 2005 3:43 pm    Post subject: Reply with quote

hello,
Why do you want write data to the flash program memory ?
Because you need data more than 4K EEPROM I suppose.

But a good idea is it to use AVR DOS see this MCS option, and a flash card

Or to use a I2C memory, very easy, 1000000 reusable, I do that.

bon courage
JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum