EEPROMs

If doesn't fit into any other category ....
User avatar
Electroguard
Posts: 945
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: EEPROMs

Post by Electroguard »

As a matter of interest, do you know if the Annex RTC functions still work with that TinyRTC module ?
Jan Volk
Posts: 107
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 34 times

Re: EEPROMs

Post by Jan Volk »

Francesco,

Wow.
This is a simple subroutine for writing and reading to an external I2C EEPROM. Thank you.
Tested this and it works perfectly.
First scan the correct address, otherwise the connection will stop with an error for no reason.
My default address is $h57 (A0, A1, A2 open)
The DS3231 RTC time works well for me.

So now one can include this sub in a control by first checking whether 255 is in the first memory during automatic start-up and then writing a standard list with good control values ​​to the EEPROM.
You can adjust this later from the program.

Jan
User avatar
Electroguard
Posts: 945
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: EEPROMs

Post by Electroguard »

Yep, works well for me too on this old module I had laying around.
Less convenient to use than BAS.RTCMEM$, but a lot more dependable.

eeprom.jpg
You do not have the required permissions to view the files attached to this post.
Jan Volk
Posts: 107
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 34 times

Re: EEPROMs

Post by Jan Volk »

Electroguard,

It is true that EEPROM is somewhat more robust than FLASH memory.
See data sheet.

2-Wire
Serial EEPROM
32K (4096 x 8)
64K (8192 x 8)
AT24C32
AT24C64

Features
• Low-Voltage and Standard-Voltage Operation
– 2.7 (V CC = 2.7V to 5.5V)
– 1.8 (V CC = 1.8V to 5.5V)
• Low-Power Devices (I SB = 2 μA at 5.5V) Available
• Internally Organized 4096 x 8, 8192 x 8
• 2-Wire Serial Interface
• Schmitt Trigger, Filtered Inputs for Noise Suppression
• Bidirectional Data Transfer Protocol
• 100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Clock Rate
• Write Protect Pin for Hardware Data Protection
• 32-Byte Page Write Mode (Partial Page Writes Allowed)
• Self-Timed Write Cycle (10 ms max)
• High Reliability
– Endurance: 1 Million Write Cycles
– Data Retention: 100 Years
• Automotive Grade and Extended Temperature Devices Available
• 8-Pin JEDEC PDIP, 8-Pin JEDEC SOIC, 8-Pin EIAJ SOIC,
and 8-pin TSSOP Packages


SPI FLASH
W25Q16RV

Features
Highest Performance Serial Flash
– 133MHz Single, Dual/Quad SPI clocks
– 266/532MHz equivalent Dual/Quad SPI
– 66MB/S continuous data transfer rate
– Min. 100K Program-Erase cycles
– More than 20-year data retention

Jan
User avatar
Electroguard
Posts: 945
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: EEPROMs

Post by Electroguard »

Yeah Jan, is no doubt an eeprom could be good for safe data, especially in event of entire Annex firmware and file system being lost or overwritten.

Now that Francesco has provided us with the mechanism, we still need to do more to make the most of it though, so I've been giving it some thought.
Ideally we should be able to save any length string (up to max eeprom size), so will need a chopper subroutine loop that keeps slicing the string into 32 byte chunks to send to the writer function, then finally adding an EOF character to the last chunk.

Needs a corresponding combiner subroutine loop to keep reading in 32 byte mouthfuls from the reader function and concatenating them into a string until it reaches the EOF character.

This will allow strings larger than 32 bytes (eg: large /path/filenames) to be saved and read back when needed.

But it is only a relatively minor extra step to be able to write/read a large string comprised of several smaller strings, which would allow it to cope with eg: a config file string containing several smaller parameter=data string pairs, which is easily done using word.getpar$ etc.
This would mean that each smaller string would require a string terminator as separator.
So I was thinking of using chr$(10) as the string terminator (separator) character, and chr$(13) as EOF marker.

All easy enough so far, just a matter of somehow linking to Francesco's functions to make them keep being stepped up as needed until EOF is reached.
Only thoughts at the moment though, cos have several bigger priorities to attend to first.
User avatar
cicciocb
Site Admin
Posts: 2194
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: EEPROMs

Post by cicciocb »

Robin, the routine I published already does what you want. You can write messages of any length, 32 is just a parameter of the eeprom, not the size of the messages. The separator is the character 255
User avatar
cicciocb
Site Admin
Posts: 2194
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: EEPROMs

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sun May 26, 2024 8:56 pm Electroguard,

It is true that EEPROM is somewhat more robust than FLASH memory.
See data sheet.

2-Wire
Serial EEPROM
32K (4096 x 8)
64K (8192 x 8)
AT24C32
AT24C64

Features
• Low-Voltage and Standard-Voltage Operation
– 2.7 (V CC = 2.7V to 5.5V)
– 1.8 (V CC = 1.8V to 5.5V)
• Low-Power Devices (I SB = 2 μA at 5.5V) Available
• Internally Organized 4096 x 8, 8192 x 8
• 2-Wire Serial Interface
• Schmitt Trigger, Filtered Inputs for Noise Suppression
• Bidirectional Data Transfer Protocol
• 100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Clock Rate
• Write Protect Pin for Hardware Data Protection
• 32-Byte Page Write Mode (Partial Page Writes Allowed)
• Self-Timed Write Cycle (10 ms max)
• High Reliability
– Endurance: 1 Million Write Cycles
– Data Retention: 100 Years
• Automotive Grade and Extended Temperature Devices Available
• 8-Pin JEDEC PDIP, 8-Pin JEDEC SOIC, 8-Pin EIAJ SOIC,
and 8-pin TSSOP Packages


SPI FLASH
W25Q16RV

Features
Highest Performance Serial Flash
– 133MHz Single, Dual/Quad SPI clocks
– 266/532MHz equivalent Dual/Quad SPI
– 66MB/S continuous data transfer rate
– Min. 100K Program-Erase cycles
– More than 20-year data retention

Jan
I would be very happy if Annex will be still alive in 2044 :-)
User avatar
Electroguard
Posts: 945
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: EEPROMs

Post by Electroguard »

Ok, I'll need to take a deeper look when I can, Francesco, cos I thought you were just hard-coding multiple short strings to specified locations.

Busy trying to create an espnow range extender at the moment: sensor sending to relay1, which forwards to relay2, etc, ... until reach receiver.
Only isolated point to point coms needed at any device, and hopefully espnow power requirements will be less than wifi, so solar battery may be more viable.

PS. I'm confident that Annex will be around for at least as long as we are, which hopefully will be for a while longer yet.
Post Reply