Electronics > Microcontrollers

[SAM] "EEPROM" dealings

(1/9) > >>

I've had a look at the sections of the SAMC datasheet that deal with the self writing capability. I gather this is probably the same as the SAMD series.

Am I right in that the datasheet's references to writing of the NVM (non volatile memory) apply also to the section dedicated to RWWEE  (EEPROM). I see there are some differences but in the two but they seem to not talk much about the RWWEE so I assume the general NVM procedures apply such as " NVM Write"

"27.6.5 NVM User Configuration" refers to selecting how many rows are to be EEPROM. one row is 256 bytes, this correlates with "Table 9-3. SAM C20/C21 RWW Section Parameters" that says the pages are 64 bytes as there are 4 pages to one row (27.6.2 Memory Organization).

Where I get confused is: "27.8.3 NVM Parameter" register. Here I can choose how many bytes are in a page. But pages are 64 bytes.... and there is a page write buffer that is limited to one page in that I have to read out 4 pages to erase the 4 page row before I write the one page buffer to a page. This makes the page buffer completely useless as I still have to act like I don't have it and buffer myself in RAM or another EEPROM location the entire row of 4 pages.

So as the page buffer is so limited how can I now go around deciding the page size?

If I understand correctly I have to write to the RWWEE space directly which will be caught by the buffer so I need to make sure I stay in the same page and then write it to memory when I am done. Further the writing into the buffer is done with another buffer that while visible to me serves no purpose I just need to make sure I stay inside it. So I have a buffer of a buffer, or I guess a 2 word/64 bit window into the buffer at a time. So I have to make sure I do not write data chunks that crosses the 8 byte window boundary or I go from writing in one 8 byte window to writing in another 8 byte window loosing the data that never got written properly......

RWEE section is the same exact flash technology as the main flash array. It is just a separate plane that can be written while main array is available for code execution.

NVM Parameter is a read-only register with information about the device.

You have 256 byte rows, which is the minimum erase unit and then you have 64 byte pages (4 in each row), which are a minimum write unit. But pages also support partial writes, you can  always change 1->0, but not the other way around. Typical for flash devices. There is also a limit on maximum 8 writes to a row before a erase is needed, but it is not enforced anywhere in the device, writing more may make data less reliable, but I have not been able to observe that in practice under normal conditions.

Page buffer is not for you to temporarily store the data, it is for the flash controller to have all the data at the same time. If you want to update a few bytes in a row you have to buffer them anyway.

And none of the things about 8 byte boundaries are correct. You do need to fill and write one page (64 bytes) at a time.

You mean the detailed description in the datasheet about the page buffers buffer of 2 words is not true? Yes I understand that the page buffer is for the internal controller. Because of the indirect way it works, while I just write to the memory address space that implicitly sets the buffer up for a page. I am not actually writing to the memory until I use the write command (or the automatic write), so I have to make sure I do everything I want on that page and then write it.

Before I do anything I will have to copy out the entire row as I have to erase before writing.

The only place I see two words are mentioned is the internal organization of the page buffer, which consists of 64-bit words, but since you are writing one 32-bit word at a time, first half gets buffered until the second half arrives. All this is to say that you should always write the page buffer linearly and all 64 bytes (16 words). Do not write in random non-linear locations.

Otherwise the buffer is described as "The page buffer contains the same number of bytes as an NVM page."

Right, so basically I will just buffer the 4 pages and then rewrite them one at a time from start to end once I am done.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version