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

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

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

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.

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

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.