Arduino Forum

Products => Arduino Due => Topic started by: mhodder on Jan 25, 2013, 11:07 pm

Title: Due EEPROM alternative? SD?
Post by: mhodder on Jan 25, 2013, 11:07 pm
Hello all,
I'm very new to arduino and am currently working on a linear positioning system using an arduino mega, as stepper motor and the accelstepper library. I am only able to get about 1000 pulses per second out of the mega due to the speed of the device. I just received my faster Due and it is capable of roughly 4000 pulses per second, so I'm planning on sticking with the Due. My machine has two buttons to adjust speed, one increases the speed by 1 and the other decreases the speed by 1. Currently I am storing the speed value using EEPROM so after a power cycle the speed will be at the last used value. My new Due does not have the ability to do EEPROM writes, so I'm looking for another method.

I have just attached an SD card reader to my Due and have successfully done read/write to a file. However due to the way arduino reads the text file I need to do some conversion to end up with the correct value (I believe this has something to do with ASCII).

Here is what i'm trying to do
Save a variable or a set of variables as values to a text file on my SD card (or multiple text files, one per variable if that is easier)
Perform power cycle
Read values from SD card and assign them to variables
Every time a variable changes, the value in the SD card would be overwritten.

Essentially I'm looking for a way to replace the standard EEPROM function with an SD card.
Speed is the simplest of all the variables and will be in the form of 1 to 100.
I also need position values to two decimal places.

Any help is greatly appreciated
Thanks

Title: Re: Due EEPROM alternative? SD?
Post by: kcore on Jan 26, 2013, 12:10 am
Why not use an external EEPROM?

They are cheap and almost never wear out compared to the SD card and you can pick up something like the 24LC256 for very cheap.

https://www.sparkfun.com/products/525 (https://www.sparkfun.com/products/525)
Title: Re: Due EEPROM alternative? SD?
Post by: mhodder on Jan 26, 2013, 01:40 am
That looks promising, what library do I need to interact with it? Will it act the same or similar to the standard arduino EEPROM.

On a side note I was able to read numerical values from my sd card and import them into a variable. I don't think it will be a very fast process though.

Title: Re: Due EEPROM alternative? SD?
Post by: spencoid on Jan 26, 2013, 07:45 pm
i am writing and reading 512 byte buffer dumps to an SD card in 1.1 ms while running an external interrupt and doing a fair amount of processing. SDfat works about two to four times faster than the original SD library and also has a bunch of fun methods.
Title: Re: Due EEPROM alternative? SD?
Post by: LucaV72 on Jan 26, 2013, 08:00 pm
Hi,
I am using SST25VF016B flash (2 MB) with DUE and I am quite happy with it. I am writing a small Lib to interface with it. You can find it here: http://luca72.xoom.it/td5mapsuiteweb/archive/FlashLib.zip (http://luca72.xoom.it/td5mapsuiteweb/archive/FlashLib.zip). It is not yet finished, but quite complete. It is pretty fast (I drive SPI bus at 42 MHz, DUE half speed) and you can address it as if it was an EEPROM.
Luca
Title: Re: Due EEPROM alternative? SD?
Post by: spencoid on Jan 26, 2013, 08:51 pm
i am very interested in this. how complete is the library? can i start fiddling with it as it is or is there anything to look out for? i tried unsuccessfully to get similar chips to work with the digilent chipkit board which is one of the reasons i switched over to the DUE. it took me just a day to rewrite a major sketch to work on the DUE and it is perfect with the SDfat library that was not available for the chipkit.

i bought some Micron 5PQs because they are 128 meg and looked very useful. the instruction set is similar to the one you are using. i was never able to get it to work reliably. do you have any interest in checking the data sheet, comparing to the EEPROM you are using and possibly add it to the library? i would love to have 128 (8 by 16 meg) meg available for high speed data aq. dual or quad read/write modes would be great but not essential.
Title: Re: Due EEPROM alternative? SD?
Post by: cmaglie on Jan 27, 2013, 11:48 am
LucaV72

please, remember to put a link to your library here

http://arduino.cc/forum/index.php/topic,144446.0.html

when you are done!
Title: Re: Due EEPROM alternative? SD?
Post by: LucaV72 on Jan 27, 2013, 06:18 pm
Quote
how complete is the library?

The library is almost complete, I tested it succesfully on one of my SST25VF016B chips. I was able to read single and continuous byte, write single byte and erase  the whole chip. Plus I can write and read the status registry  (writing is necessary at startup to remove area protection) and read the chip vendor info. Missing parts are: 32K and 64K block erase and continuous writing (word). I will use it embedded in a 5" TFT touchscreen (it has to be soldered) I have ordered some days ago. Once the tft has arrived I will finish the library.

I do not know Micron 5PQs but I will check the datasheets. I do not think it will be difficult to adapt the library if it is a serial Flash via SPI. Of course I have to find a couple of chips to experiment on.

Quote
please, remember to put a link to your library here
http://arduino.cc/forum/index.php/topic,144446.0.html
when you are done!

I will!!!

Luca

Title: Re: Due EEPROM alternative? SD?
Post by: GTech13 on Feb 01, 2013, 01:41 pm
So the DUE does not have internal EEPROM at all?
Title: Re: Due EEPROM alternative? SD?
Post by: bobcousins on Feb 01, 2013, 04:49 pm

So the DUE does not have internal EEPROM at all?


No, only Flash.
Title: Re: Due EEPROM alternative? SD?
Post by: garygid on Sep 06, 2013, 06:03 pm
Any update on this Library?

-------
The official EEPROM library is still listed in the Standard section of
the Reference Library information, rather than in a Not-for-Due section.

Also, in the description of the EEPROM library itself, there is no mention
of the Due, that it has no EEPROM, or what alternatives might be useful.

Also, a Warning that writing to flash is not the same, since all the flash
is erased whenever the software is updated.

--------
Is there usable, non-volatile memory in the RTC?
Since the RTC is reset with each power-On or Reset, it is mostly
useless, so if it has real EEPROM, that could be used?

Title: Re: Due EEPROM alternative? SD?
Post by: bobcousins on Sep 06, 2013, 06:55 pm

Is there usable, non-volatile memory in the RTC?
Since the RTC is reset with each power-On or Reset, it is mostly
useless, so if it has real EEPROM, that could be used?


The RTC does not have any EEPROM, it has RAM which retains state while VDDBU is powered (as does the RTC unit). On the Due VDDBU is connected to 3V3. Even if you found a way to power the RTC via a battery, it looks like it only has two words you could use for user storage.

Really the best thing is to have a genuine external serial EEPROM, it's a pity the Due does not have one. They are quite small and cheap, perhaps Due v2 will have one.

It would be possible to hack one in by wiring to the SPI header and gluing the EEPROM on top of the SAM3X8E, just needs a SOIC8 breakout board.
Title: Re: Due EEPROM alternative? SD?
Post by: m3741 on Oct 03, 2013, 06:16 am
If you're willing to do a little hardware and software mod, the Due can be made to use the flash available on the 16u2. See my writeup at http://forum.arduino.cc/index.php?topic=191298.0 (http://forum.arduino.cc/index.php?topic=191298.0)
Title: Re: Due EEPROM alternative? SD?
Post by: DRiVER_helsinki on Nov 02, 2014, 09:49 am
Does the  slow speed of external  slow eeprom chip  slow Due,  if used ?