PROGMEM access speed

Hello everybody,

I've been searching on the web for an hour or so and I couldn't find much information about PROGMEM access speed.

I'm currently writing the code for a POV globe (I have not yet received the components, but they are on their way!) and I realised that I'm running out of SRAM (only 2.5 Kb available).

I would like to use Flash memory to store my data, but my question is: will it be fast enough?

I would have to do at least 92 160 accesses per second, and 245 760 at the most.

If it is not fast enough, I can do two thirds of these accesses in SRAM and only the third in PROGMEM, but again, same question here...

Thanks for your help!

I dont have a hard number for you, but it does take extra steps to get data from PROGMEM so it will be a little slower than normal SRAM, but at that point your counting cpu cycles at 16Mhz (what is that like 64ns per cycle) ... using arduino your wasting 10x the cycles switching a pin over banging the registers, so it may not be enough to effect your project

Thanks for your fast answer!

However, I'm unsure about the last part; are you saying that it will be alright or not?

(sorry for that, english is not my main language >.<)

I am saying the best way to find out is to check it yourself, but I think it would be fine, as your speed problems (if you have any) is more likely to be getting the signals out to the LED's due to switching speed in the arduino libraries (thats the cost of being portable and easy to use across many chips)

Great, thank you very much! :slight_smile:

In this project I read font data from program memory when timing was very tight:

I think you will find it takes 3 clock cycles to read from PROGMEM compare to two for RAM. So it is 62.5 nS slower (per byte).

245760 * 62.5e-9 * 2 = 0.03072 seconds
...
245760 * 62.5e-9 * 3 = 0.04608 seconds

So you would lose about 15 mS to read 245760 of them from PROGMEM rather than RAM.

Mind you, you don't have 245760 bytes of PROGMEM, nor RAM.

1 Like

in fairness he didnt say bytes, but accesses ... it could be 4 bytes accessed 245760 times a second for all we know

:stuck_out_tongue:

True, like my font pixel data. Still, it shouldn't be a big issue.

1 Like