RM0453 Rev 2 109/1454
RM0453 Embedded Flash memory (FLASH)
153
change due to Flash operation requests by the other CPU, to limit the risk of receiving
a bus error when starting programming).
4. Check and clear all error programming flag due to a previous programming.
5. Set FSTPG in FLASH_CR or FLASH_C2CR.
6. Write the 32 double-words to program a row (256 bytes).
7. Wait until BSY is cleared in FLASH_SR or FLASH_C2SR.
8. Check that the EOP flag is set in FLASH_SR or FLASH_C2SR (meaning the
programming operation succeeded), and clear it by software.
9. Clear FSTPG in FLASH_SR or FLASH_C2SR if there are no more programming
requests.
Note: For correct operation, the firmware must guarantee that the Flash page access protection is
not changed during the fast programming sequence. This is between any of the 32 word
writes.
Note: When attempting to write in Fast programming mode while a read operation is ongoing, the
programming is aborted without any system notification (no error flag is set).
When the Flash memory interface receives the first double-word, programming is
automatically launched. The BSY bit is set when the high voltage is applied for the first
double-word, and it is cleared when the last double-word is programmed or in case of error.
The internal oscillator HSI16 (16
MHz) is enabled automatically when FSTPG is set, and
disabled automatically when the FSTPG bit is cleared, except if the HSI16 is previously
enabled with HSION in the RCC_CR register.
The 32 double-word must be written successively. The high voltage is kept on the Flash
memory for all the programming. Maximum time between two double-words write requests
is the time programming (around 20
µs). If a second double-word arrives after this time
programming, fast programming is interrupted and MISSERR is set.
High voltage must not exceed 8 ms for a full row between two erases. This is guaranteed by
the sequence of 32 double-words successively written with a clock system greater or equal
to 8
MHz. An internal time-out counter counts 7 ms when Fast programming is set and stops
the programming when time-out is over. In this case FASTERR is set.
If an error occurs, high voltage is stopped and next double-word to programmed is not
programmed. Anyway, all previous double-words have been properly programmed.
Programming errors signaled by flags
Several kind of errors can be detected. In case of error, the Flash operation (programming
or erasing) is aborted.
• PROGERR: programming error
In standard programming, PROGERR is set if the word to write, with a different value
than all zero, is not previously erased (except if the value to program is all zero).
If any other error occurs (such as SIZERR, PAGERR, PGSERR, WRPERR),
PROGRERR may not be set even if there is a word re-programming without erase
error.
• SIZERR: size programming error
In standard programming or in fast programming: only double-word can be
programmed and only 32-bit data can be written. SIZERR is set if a byte or an
half-word is written.
• PGAERR: alignment programming error