![Atmel SAM4S Series Preliminary Data Sheet Download Page 334](http://html1.mh-extra.com/html/atmel/sam4s-series/sam4s-series_preliminary-data-sheet_3003408334.webp)
334
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
Data are written to the latch buffer before the programming command is written to the Flash
Command Register EEFC_FCR. The sequence is as follows:
• Write the full page, at any page address, within the internal memory area address space.
• Programming starts as soon as the page number and the programming command are written
to the Flash Command Register. The FRDY bit in the Flash Programming Status Register
(EEFC_FSR) is automatically cleared.
• When programming is completed, the FRDY bit in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the corresponding interrupt line of the NVIC is activated.
Two errors can be detected in the EEFC_FSR register after a programming sequence:
• Command Error: a bad keyword has been written in the EEFC_FCR register.
• Lock Error: the page to be programmed belongs to a locked region. A command must be
previously run to unlock the corresponding region.
• Flash Error: at the end of the programming, the WriteVerify test of the Flash memory has
failed.
By using the WP command, a page can be programmed in several steps if it has been erased
before (see
below).
Figure 19-7. Example of Partial Page Programming
19.4.3.3
Erase Commands
Erase commands are allowed only on unlocked regions. Depending on the Flash memory, sev-
eral commands can be used to erase the Flash:
• Erase all memory (EA): all memory is erased. The processor must not fetch code from the
Flash memory.
• Erase pages (EPA): 4, 8, 16 or 32 pages are erased in the memory plane. The first page to
be erased is specified in the FARG[15:2] field of the MC_FCR register. The first page number
must be modulo 4, 8,16 or 32 according to the number of pages to erase at the same time.
The processor must not fetch code from the Flash memory.
Erase All Flash
Programming of the second part of Page Y
Programming of the third part of Page Y
32-bit wide
32-bit wide
32-bit wide
X words
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
...
CA FE CA FE
CA FE CA FE
CA FE CA FE
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
CA FE CA FE
CA FE CA FE
CA FE CA FE
DE CA DE CA
DE CA DE CA
DE CA DE CA
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
FF FF FF FF
Step 1.
Step 2.
Step 3.
...
...
...
...
...
...
...
...
...
...
...
X words
X words
X words
So Page Y erased
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...