335
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
• Erase Sector (ES): A full memory sector is erased. Sector size depends on the Flash
memory. FARG must be set with a page number that is in the sector to be erased. The
processor must not fetch code from the Flash memory.
The erase sequence is:
• Erase starts as soon as one of the erase commands and the FARG field are written in the
Flash Command Register.
– For the EPA command, the 2 lowest bits of the FARG field define the number of
pages to be erased (FARG[1:0]):
• When the programming completes, the FRDY bit in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the FRDY bit in EEFC_FMR,
the 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: at least one page to be erased belongs to a locked region. The erase command
has been refused, no page has been erased. A command must be run previously to unlock
the corresponding region.
• Flash Error: at the end of the programming, the EraseVerify test of the Flash memory has
failed.
19.4.3.4
Lock Bit Protection
Lock bits are associated with several pages in the embedded Flash memory plane. This defines
lock regions in the embedded Flash memory plane. They prevent writing/erasing protected
pages.
The lock sequence is:
• The Set Lock command (SLB) and a page number to be protected are written in the Flash
Command Register.
• When the locking completes, the FRDY bit in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the FRDY bit in EEFC_FMR,
the interrupt line of the NVIC is activated.
• If the lock bit number is greater than the total number of lock bits, then the command has no
effect. The result of the SLB command can be checked running a GLB (Get Lock Bit)
command.
One error 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.
• Flash Error: at the end of the programming, the EraseVerify or WriteVerify test of the Flash
memory has failed.
Table 19-4.
FARG Field for EPA command:
FARG[1:0]
Number of pages to be erased with EPA command
0
4 pages
1
8 pages
2
16 pages
3
32 pages
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 ...