And the command to erase and write on memory, should have an answer from
hardware saying that action was performed -- because erase the whole
memory and write data takes take, memory will be busy, so, I think that
software should not continue while don't receive an confirmation of
action successeful performed.
Actual API have the command: "Command 13: Write memory byte" -- I can't
implement that because to write the byte on DataFlash memory address xx,
I must before erase address xx!
DataFlash memory can't erase one byte only, just blocks of 4kB, 32kB,
64kB or the whole memory.
Could be a better way than erase all memory before write?
You can read the datasheet: http://www.farnell.com/datasheets/103577.pdf
Anyway, it makes sense to have a clearMemory API function, to erase
all the memory. But a problem arises, with different memories the API
will have no effect, because it will need to implement different
commands.
Is it possible to send all writes to the memory through the microchip?
And do all reads through it too?
Well, If we use EEPROM, firmware can also implement the erase all memory
command.
> Is it possible to send all writes to the memory through the microchip?
> And do all reads through it too?
I am not sure I understand your question, but the read, write and erase
commands API are performed by MCU (microchip), to the memory.
I don't see any big problem, just the memory must be all erased before
writing on it.
Okok.
> 2. the write command being implemented by the firmware, will have the
> work of erasing the necessary blocks prior to the writing itself (in
> the DataFlash case)
EI!! I didn't suggest this ;-) eheh - I don't know I could a do
that... I was thinking about and I couldn't find a solution, thats why
I suggest erase all memory.
Do you have an idea how MCU could do that? -- because if I just want
to write a byte, I need to erase the at least 4kB...
ok, I explain my problem: I can't write 1 byte right? If I write some
images into the memory, all be fine. But next time, I want to change
some images I will always have to read them all, erase all memory and
write all again.
If for you this is not a problem, we can implement this behaviour for
all MCU within the function "write" that before writing can erase all
memory, allowing writenext to work as expected
Yes, is not possible with this DataFlash memory and with this MCU. If
I had more than 4kB RAM, I could try read 4kB and after erase and
write one new byte and other bytes.
> If for you this is not a problem, we can implement this behaviour for
> all MCU within the function "write" that before writing can erase all
> memory, allowing writenext to work as expected
I don't like the idea that a write command erases all memory. Write
command should work as expected, in this specific case of DataFlash
memory, memory must be erased before any write command.
My suggestion is the initial, a new command on API to erase all memory.
So writenext and readnext will disapear from API :-)
readnext functionality can pass to read, also the same to write. So
API can be shortened to less 2 commands.
Well, If software sends the 1st read command and the address to
hardware, MCU will start a counter to store and increment the address.
Next read command will not have the address -- DataFlash memory works
like this, so, I think we can do like that on our API, just to save
that xxnext commands.
So, this is something that depends on firmware and not memory :-)