ST STM32G0 1 Series Reference Manual page 77

Table of Contents

Advertisement

RM0444
The Main Flash memory programming sequence in standard mode is described below:
1.
Perform a mass or page erase. If not, PGSERR is set.
2.
Check that no Main Flash memory operation is ongoing by checking the BSY1 bit of the
FLASH status register
3.
Check and clear all error programming flag due to a previous programming.
4.
Set the FSTPG bit in
5.
Write 32 double words to program a row (256 bytes).
6.
Wait until the BSY1 bit of the
7.
Check that EOP flag of the
operation succeeded), and clear it by software.
8.
Clear the FSTPG bit of the
programming requests anymore.
Note:
When attempting to write in Fast programming mode while a read operation is on going, the
programming is aborted without any system notification (no error flag is set).
When the Flash memory interface has received the first double word, programming is
automatically launched. The BSY1 bit is set when the high voltage is applied for the first
double word, and it is cleared when the last double word has been programmed or in case
of error. The internal oscillator HSI16 (16 MHz) is enabled automatically when FSTPG bit is
set, and disabled automatically when FSTPG bit is cleared, except if the HSI16 is previously
enabled with HSION in RCC_CR register.
The 32 double words 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 the FASTERR bit 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
Several kind of errors can be detected. In case of error, the Flash memory operation
(programming or erasing) is aborted.
PROGERR: Programming Error
In standard programming: PROGERR is set if the word to write is not previously erased
(except if the value to program is full zero).
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
PGAERR is set if one of the following conditions occurs:
(FLASH_SR)..
FLASH control register
In standard programming: the first word to be programmed is not aligned with a
double word address, or the second word doesn't belong to the same double word
address.
(FLASH_CR).
FLASH status register (FLASH_SR)
FLASH status register (FLASH_SR)
FLASH status register (FLASH_SR)
RM0444 Rev 5
Embedded Flash memory (FLASH)
is cleared.
is set (programming
if there are no more
77/1390
118

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32G0 1 Series and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF