2

I'm using EEPROM to store long term data for use in sketches (thanks to DarthRubik for the guidance). I store stuff like a location ("Garden") and a device name ("Greenhouse Monitor 02") plus whatever else I'd need to store to help filter through data.

When this information is stored in the sketch itself it is recalled quickly and accurately, is passed via wifi to my PHP, that then posts the data to the relevant fields in my AWS db. Piece o' cake! When I store it in the EEPROM, the extra time required to find it in EEPROM, pull it through the sketch, and then push it through to the db corrupts the data sourced from EEPROM and posts a jumbled mess of characters...if it even makes it to the db at all.

My question is actually simple (I think):
Is it possible to "stage" strings from EEPROM in flash or SRAM vs. pulling cold from EEPROM?

I think PROGMEM plays a role here and I'm looking at examples oh how other sketched employ PROGMEM to better understand how to use it.

I am withholding the code for now because I want to try to implement concepts people may describe before I am just shown the solution...although that would be easier. If I can't figure it out I'll post the code for more direct answers.

  • 1
    I don't play a lot with EEPROM but your description of "extra time" making the whole stuff fail, looks weird to me. I guess we are talking about a few ms here only. Have you measured that time? – jfpoilpret May 19 '16 at 5:35
  • No. I haven't. Can you point me to a sketch timer (or whatever it's called)? – acpilot May 19 '16 at 5:37
  • 2
    I would say your assumption that 'it is slow so it is corrupting the data' is wrong. Do you know that the data is correct? Do you know that you are really storing and retrieving the right things? – Majenko May 19 '16 at 8:38
  • 1
    I just measured it: a single call to EEPROM.read() takes about 1.8 µs (microseconds, yes, not milliseconds). – Edgar Bonet May 19 '16 at 11:07
  • Please post the code you currently use to get your data from EEPROM. Without viewing it, it will be very hard to point you into the right direction. – jfpoilpret May 22 '16 at 12:49
3

When I store it in the EEPROM, the extra time required to find it in EEPROM, pull it through the sketch, and then push it through to the db corrupts the data sourced from EEPROM and posts a jumbled mess of characters...if it even makes it to the db at all.

Are you certain of that? It is incredibly unlikely that mere time will corrupt characters and data as they are read and sent - especially the minuscule amounts of time we are talking here.

Is it possible to "stage" strings from EEPROM in flash or SRAM vs. pulling cold from EEPROM?

Yes, and you are already doing so, since you can't send direct from EEPROM to WiFi - you have to go via SRAM. You read from EEPROM into SRAM then send from SRAM through WiFi. You just won't be doing it an entire string at once.

I think PROGMEM plays a role here and I'm looking at examples oh how other sketched employ PROGMEM to better understand how to use it.

No, it doesn't. PROGMEM is for storing strings and other data within your sketch. It has nothing at all to do with EEPROM.

I am withholding the code for now because I want to try to implement concepts people may describe before I am just shown the solution...although that would be easier. If I can't figure it out I'll post the code for more direct answers.

Without seeing your code no one is really going to be able to help you. I suspect (although I am stabbing wildly in the dark) that your EEPROM reading/writing code is completely wrong and you aren't actually storing the data you expect in the EEPROM, nor reading it back properly. Unless we see your code we can't know what is going on, and so we don't have a cat's hope in hell of diagnosing your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.