Go Down

Topic: loading images from external memory (Read 1 time) previous topic - next topic

casemod

Hi,

I am currently loading images from an SD card which tends to be quite a slow method. I was wondering if it I could interface some flash/eeprom chip instead. Would that make readings faster?

Any references where I can find some more information about the subject?

Regards

Peter_n

Try the newest Arduino 1.5.7 BETA, the SD library is improving and getting faster.

With a small optimization you can achieve about 16kbyte per second (I'm not sure, but the number of '16' is in my memory). You do that by reading a buffer of 16 or 32 bytes at once from the SD card.
Most EEPROMs are with I2C, that is slower. A SPI EEPROM is faster, like this one: http://arduino.cc/en/Tutorial/SPIEEPROM but I think it is still slow. The SD cards are made for high speed, an EEPROM is not.
Octal is 7 bits. Octet is 8 bits. An Octopus has four pairs of arms. October is the tenth month. An Octillion can be 10^27 or 10^48. An Octave is the interval between notes of half or twice the frequency. And last but not least: Octyl on its own is not really something.

aeternus

How slow is it exactly? Are you using hardware SPI for that or a bit-banged implementation? What is the amount of data you are pushing thtough? It's hard to answer when the question is vague.

I am using micron spi flash at the moment (M25P80) and the datasheet says while reading it can go up to 33MHz SPI - that's way faster than an arduino can clock it anyway. The lack of filesystem abstraction also improves speed.

aeternus

Kinnishian


Try the newest Arduino 1.5.7 BETA, the SD library is improving and getting faster.

With a small optimization you can achieve about 16kbyte per second (I'm not sure, but the number of '16' is in my memory). You do that by reading a buffer of 16 or 32 bytes at once from the SD card.
Most EEPROMs are with I2C, that is slower. A SPI EEPROM is faster, like this one: http://arduino.cc/en/Tutorial/SPIEEPROM but I think it is still slow. The SD cards are made for high speed, an EEPROM is not.



fat16lib guy would know better, but I assume that's because the older Sd.h used an old version of sdfat.
The actual sdfat library can be quite fast.

casemod

#4
Aug 21, 2014, 12:55 pm Last Edit: Aug 21, 2014, 01:20 pm by casemod Reason: 1
Thank you all for your thoughts,

I am currently reading at a speed of 60KBytes/s.
This is for a menu system and the whole display takes about 2800ms to load a full 320x240 bmp.

A few things come to mind:


  • Use some sort of flash IC, not I2C, but parallel (SPI is dead slow on an arduino!)

  • Reduce the color depth of the bmp. For most cases 256 colors would be enough and would result in the image being loaded 3x faster, however the library does not accept them (Same for raw images)

  • Increase the SPI speed -
    edit Changed SD init SPI_HALF_SPEED to SPI_FULL_SPEED on SD.cpp file, now I get 90KB/s - Still not close to load that image in 1 second


Mr_arduino

I would not bother with any other type of external memory until I am sure I tried everything with the SD card.
Try using the real sdfatlib instead of SD.h. Also do not read byte by byte if you are doing such. Try reading 512 bytes and then send those 512 bytes to the lcd screen and repeat until done. Also make your own image format for example
uint16_t width
uint16_t height
(Data that is already in LCD's native pixel format and does NOT need any conversion).
Doing this should cause a speedup. Also another idea is instead of just storing the already converted data to whatever the LCD screen uses, if your images does not have that many colors you can first store a palette (a table of colors that are already in the LCD's native format) and then just store what entry should be used in the palette. Doing this can double the reading speed if not more.

Kinnishian

As far as I understand, you're using the regular arduino sd library.

I would give a shot running the arduino library benchtest, assuming there's an example test for that.

Then, run the benchtest with this library:
http://forum.arduino.cc/index.php?topic=259317.0

Perhaps the speed improvements would be enough.


casemod

Yes I am.

I just finished (uff!!!) porting my code to use SDlib instead. The improvement is reasonable, I can now load an image in 1800ms, but still not close to my goal of 1S.

Any further ideas?

Mr_arduino

I am glad to hear that I was correct in assuming that using Sdfatlib would bring faster speed.
Did you read the other parts of my post? It had other ideas besides changing what library you used. Also in case Sdfatlib defaults to half speed change it to full speed like you did for the SD.h library.

Go Up