EEPROM.write

Status
Not open for further replies.

Gadget999

Well-known member
it appears eeprom.write will only save numbers up to 255

is there another way to do this on a T3.2 ?

how many times can you write to the eprom before it fails ?

is it better to save my data to an sd card instead ?
 
it appears eeprom.write will only save numbers up to 255

is there another way to do this on a T3.2 ?

how many times can you write to the eprom before it fails ?

is it better to save my data to an sd card instead ?

Use the EEPROM 'put' function instead of 'write'. The 'write' function only writes a single byte, while the 'put' function uses a C++ template and it writes an entire data structure (or scalar type). Use the 'get' function to read it back.

See the examples 'eeprom_put.ino' and 'eeprom_get.ino' for more information.

In theory, the EEPROM on the Teensy 3.2 can do 100M read/write cycles (https://www.nxp.com/docs/en/application-note/AN4282.pdf), but Paul can probably tell you what configuration that is used in the Teensy 3.2 is actually rated at.

In terms of using a SD card over flash, it depends on how often you write to EEPROM, whether you need to remove the data, etc.

Note, for the other users reading this, I believe the Teensy LC is the only ARM based Teensy where it is recommended not to use EEPROM, since it doesn't have a separate EEPROM area, and just uses a bit of the program flash memory.
 
Last edited:
Use the EEPROM 'put' function instead of 'write'. The 'write' function only writes a single byte, while the 'put' function uses a C++ template and it writes an entire data structure (or scalar type). Use the 'get' function to read it back.

See the examples 'eeprom_put.ino' and 'eeprom_get.ino' for more information.

In theory, the EEPROM on the Teensy 3.2 can do 100M read/write cycles (https://www.nxp.com/docs/en/application-note/AN4282.pdf), but Paul can probably tell you what configuration that is used in the Teensy 3.2 is actually rated at.

In terms of using a SD card over flash, it depends on how often you write to EEPROM, whether you need to remove the data, etc.

Note, for the other users reading this, I believe the Teensy LC is the only ARM based Teensy where it is recommended not to use EEPROM, since it doesn't have a separate EEPROM area, and just uses a bit of the program flash memory.

Thank you :)
 
Use the EEPROM 'put' function instead of 'write'. The 'write' function only writes a single byte, while the 'put' function uses a C++ template and it writes an entire data structure (or scalar type). Use the 'get' function to read it back.

See the examples 'eeprom_put.ino' and 'eeprom_get.ino' for more information.

In theory, the EEPROM on the Teensy 3.2 can do 100M read/write cycles (https://www.nxp.com/docs/en/application-note/AN4282.pdf), but Paul can probably tell you what configuration that is used in the Teensy 3.2 is actually rated at.

In terms of using a SD card over flash, it depends on how often you write to EEPROM, whether you need to remove the data, etc.

Note, for the other users reading this, I believe the Teensy LC is the only ARM based Teensy where it is recommended not to use EEPROM, since it doesn't have a separate EEPROM area, and just uses a bit of the program flash memory.
the t4 does the same
 
Teensy LC wear levels 128 bytes over 2K of flash. NXP specifies the flash endurance at 10,000 write cycles minimum, 50,000 typical. NXP specifies 5 years minimum retention, 50 years typical. NXP rates this over a very wide -40 to +125C temperature range.

Teensy 4.0 wear levels groups of 72 bytes over 4K. Winbond flash chip on Teensy 4.0 is rated for endurance of at 100,000 write cycles minimum. I did not see a "typical" spec. Winbond claims 20 years retention, but it's not clear if that's a minimum or typical spec. Winbond's temperature range is less, -40 to +85C. When comparing to NXP's seemingly not-as-great specs, consider NXP's extend to much higher temperature.

Both write 2 bytes to flash for every 1 emulated byte written.

So as an example, if you write a 32 bit number, on both that will cause 8 bytes to be written to flash (assuming all 4 bytes actually changed). On Teensy LC, you can do that 256 times before you're used up 1 of the 10,000 write cycles. So you could consider it to be able to write 2.56 million times for that case.

On Teensy 4.0, you can do 512 of those writes before using up 1 cycle (if all 4 are mapped to the same 4K sector). So you could consider the write limit to be 51.2 million times.

If you write 8 bytes instead of 4, you'll use up the write cycles twice as fast, 16 byte 4X faster, and so on. But on Teensy 4.0, there are 15 different 4K sectors used, so if you write more data it will tend to spread across sectors.

Teensy 3.2,3.5, 3.6 use a very different wear leveling approach which is implemented in hardware. The details here apply only to LC & 4.0 where the wear leveling is done by software.
 
Status
Not open for further replies.
Back
Top