RM0461
Only the main memory can be programmed in Fast programming mode.
The flash main memory programming sequence in Fast programming mode is described
below:
1.
Perform a mass erase. If not, PGSERR is set.
2.
Check that no flash main memory operation is ongoing by checking BSY bit
FLASH_SR.
3.
Check that flash memory program and erase operation is allowed by checking PESD in
FLASH_SR.
4.
Check and clear all error programming flag due to a previous programming.
5.
Set FSTPG in FLASH_CR.
6.
Write the 32 double-words to program a row (256 bytes).
7.
Wait until BSY is cleared in FLASH_SR.
8.
Check that the EOP flag is set in FLASH_SR(meaning the programming operation
succeeded), and clear it by software.
9.
Clear FSTPG in FLASH_SR if there are no more programming requests.
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
RM0461 Rev 5
Embedded flash memory (FLASH)
79/1306
108
Need help?
Do you have a question about the STM32WLEx and is the answer not in the manual?