Go Down

Topic: arduino databse eeprom lib (Read 3537 times) previous topic - next topic

yair

im looking for a db lib
all dedicated solutions i found are broken on 1.0
roll my own?

http://www.arduino.cc/playground/Code/ExtendedDatabaseLibrary
http://www.arduino.cc/playground/Code/DatabaseLibrary

PaulS

Quote
all dedicated solutions i found are broken on 1.0

So? Fix one of them.

You really don't have a lot of room for a database on an Arduino. 2K doesn't hold a lot of data.

yair

ok, attached zip of extendeDb lib compiles under 1.0.1


robtillaart

Thanks for sharing,

added a link on - http://arduino.cc/playground/Code/ExtendedDatabaseLibrary - to this thread so people see your updated lib
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

yair

thanks robtillaar, to make compatible i replaced WProgram.h with

Code: [Select]
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"


actually i dont real like that lib, made me want to get closer to the metal.
anyways i did some benchmark using EEPROMEx lib, and was a bit shocked to find out the write speeds of EEPROM

Code: [Select]
Check how much time until EEPROM ready to be accessed
-----------------------------------------------------
Time to write 1 byte  (ms)                        : 0
Recovery time after writing byte (ms)             : 4
Time to write Long (4 bytes) (ms)                 : 10
Recovery time after writing long (ms)             : 4
Time to read Long (4 bytes) (ms)                  : 0
Recovery time after reading long (ms)             : 0
Time to write 7 byte array  (ms)                  : 20
Time to update 7 byte array with 7 new values (ms): 18
Time to update 7 byte array with 3 new values (ms): 10
Time to read 7 byte array (ms)                    : 0


so i've been thinking about moving over to PROGMEM land (using this FLASH lib).

my db is about 510 bytes.
is flash memory a better path?
not just for speed. any cons?

PaulS

Quote
so i've been thinking about moving over to PROGMEM land (using this FLASH lib).

my db is about 510 bytes.
is flash memory a better path?
not just for speed. any cons?

Besides being read-only? Nope. Can't think of any.


yair

dont get it, eeprom is also technically "read only"
http://www.arduino.cc/playground/Learning/Memory

i've seen text that mentioned you can not use progmem to write variables.
but the learning page is a bit slim on details.

dxw00d

Where does it say that EEPROM is read-only? It says

Quote
EEPROM is memory space that programmers can use to store long-term information.


and

Quote
...EEPROM memory are non-volatile (the information persists after the power is turned off).


Neither of which imply read-only.

yair

Electrically Erasable Programmable Read-Only Memory

dxw00d


Electrically Erasable Programmable Read-Only Memory


I know what it means. It's a bit of a misnomer really though.

robtillaart

wrt performance issues:

The database code does not take into account that EEPROM writes are often done in pages (chucks of bytes, powers of 2, 16/32/64 etc)
If you need to updat 7 vars in 1 page you can do that in 7 writes but also in 1.
Seems that you did it per byte.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

yair

thanks for the tip,

so:
Quote from: http://arduiniana.org/libraries/flash
PROGMEM (Flash) data region can only be populated at program burn time. You can't change the values in the flash after the program has started running.

i think its worth mentioning in the learning.Memory section.

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up