Slow EEPROM.read and EEPROM Write

Asked 2 months ago, Updated 2 months ago, 3 views

It takes about 10 ms to process one EEPROM.read() and 57 ms to process EEPROM.write().
Even if I just commented out delay() with eeprom_read and eeprom_write in the example sketch for Spresense, it will take the above time, but will it take this long for development with Arduino IDE?

Add

Thank you for your comment.
I'm using 8MB of flash memory on the spresense main board.
The Arduino IDE Developer Guide for Spresense contains
"Spresense does not have an EEPROM, so we use SPI-Flash memory to emulate it. The EEPROM library allows you to write and load EEPROMs emulated by SPI-Flash."
is described as

When I increased the size of the EEPROM by changing the E2END value described in EEPROM.h, EEPROM.read() and .write() also slowed down.
Even if I use EEPROM.read() for one byte, is it possible that I am slow because I have access to all the EEPROMs I have secured?

spresense

2022-09-30 14:02

2 Answers

Memory commonly referred to as EEPROM has the following characteristics:
- Read and write in bytes
- If you want to write multiple bytes, you can do it within the "page" range
- No pre-deletion is required when writing (deletion in memory chip → may be writing, but programmers do not need to be aware of this)
- After sending a write instruction, you will not be able to read or write to the next one until the internal process is complete.

On the other hand, NOR-Flash memory typically has the following characteristics:
- Readable in bytes
- Writeable in fixed sizes from a few bytes to a few hundred bytes (e.g., 256 bytes)
- Can be erased in fixed sizes in kilobytes (e.g., 4096 bytes / 32768 bytes)
- Write only to erased areas (cannot overwrite written areas)
- After sending erase/write instructions, the next read/write is not possible until internal processing is complete

Therefore, in order to imitate EEPROM in NOR-Flash,
-
Read the erase area into RAM once - Change values on loaded RAM
- Clear
- US>Write
You will need to go through the procedure (unexpectedly troublesome)

According to the specifications of the chip (can I name it?) that Oira has now,
- SPI Clock Maximum Frequency 108 MHz
- tSE(time for sector erase) type 38 msec with Erase 4096 bytes
- Program 256 bytes tPP (time for program page) type 0.8 msec
- New memory is usually faster
So

If you are generating SPI signals in hardware, the suggested read time is incredibly slow (a level at which you suspect the measurement is incorrect).On the other hand, if it's software-generated, it might be something like that.Depending on how much clock frequency is generated on the bus.

If you are serious about the above procedures, I think that's the way to write.


2022-09-30 14:02

v1.1.3 appears to have improved Read/Write processing speed for EEPROMs.
https://github.com/sonydevworld/spresense-arduino-compatible/releases/tag/v1.1.3

I took a quick look and found that
byte units such as EEPROM.read(), EEPROM.write() Reading and writing are getting a little faster (about a few ms), but it hasn't changed much.
However, when it comes to reading and writing multiple bytes using EEPROM.get(), EEPROM.put(), (the size is
The bigger it is, the more effective it is.

It seems to be emulated by SPI-Flash, so considering the characteristics and lifespan of SPI-Flash,
Pack the information you want to write nonvolatile into the structure and use EEPROM.put(), EEPROM.get() once. Reading and writing sounds good.


2022-09-30 14:02

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.