Pages: [1]   Go Down
Author Topic: Is there a way to use some flash ram as dynamic ram?  (Read 545 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now that Arduino 1.0 is out and we can have multiple SD files open at the same time, I have a program that opens small SD card files one at a time when needed, extracts their chr contents, and stuffs those chrs into another temporary file (about 7k) on the SD card.  It takes about 32 seconds to open/close my many small files, but works.  Now I would like it to be 20 times faster overall.

I have considered external EEPROM usage, and that may be viable, but I am wondering about flash ram usage.

I have successfully used PROGMEM in the past where I need to refer to data that does not change, but I have not found a way to have my program write/read dynamic data to a region of flash above my program code.

Is there a way to use some flash ram as dynamic ram?

Thank you for your suggestions.

     Bob Pigford
     Newark, DE, USA
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26290
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there a way to use some flash ram as dynamic ram?
Short answer, no.

Longer answer, not really.
You'd need to write a whole new bootloader.
I don't think it would improve performance
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It is, theoretically, possible, but very hard to achieve, and probably the results wouldn't be desirable.  The problems:

1. Writing flash is slow.  I don't know about the AVR, but if it's like a PIC, then the whole processor stalls while writing a block of flash.
2. Flash can only be written once erased.
3. Flash can only be erased in blocks.
4. Flash can only be written a certain number of times before it becomes unstable.

So you'd (1) probably see a slowdown instead of a speedup, (2/3) have to make sure that you set aside an area of flash that the sketch would never get placed into that is a multiple of the flash page size big, and (4) kill your AVR chip in no time at all.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you AWOL and majenko.  You have clarified it for me.  And I do now remember some PIC16F876A programming in the past WRT 14-bit block reads/writes and erasures.  I think I will not go down that path again!

Thank you again for your counsel.
     Bob
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could look at SPI RAMTRON FRAM for fast access like SRAM and power-down storage capability of Flash/EEPROM without the write speed penalty.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: