2020-06-24 01:07 AM
Hi everyone!
I'm implementing a 4k XMODEM bootloader for the STM32G030F6. The application starts at 0x08001000 (page 2)
I want to erase page 2 (0x08001000 - 0x080017FF) and only program rows 17 to 19 (0x08001100 - 0x080017FF). I want to save row 16 in SRAM and write it last (after the whole application has been written to Flash).
When the XMODEM transfer completes and the FW tries to write row 16 (0x08001000 - 0x080010FF) I get multiple flash errors (PGAERR, PGSERR, FASTERR).
Does this mean that I have to save the whole page in SRAM (not just the row)? Why can't I write a flash row if it has been erased before?
Thanks in advance,
Pieter
2020-06-24 06:38 AM
This should be possible. There are some gotchas when writing to flash, especially when using fast mode, see "3.3.8 FLASH Main memory programming sequences" in the RM. Post your code if you want.
2020-06-24 06:46 AM
I don't have any G0 parts, but other parts allow you to selectively write, down to the flash-line length.
You might want to use a longitudinal checksum so you don't jump to partial, corrupt or incomplete images.
2020-06-24 06:56 AM
Hi @TDK and @Community member
I should have mentioned that I'm using Fast programming (not Standard programming) to program a whole row of 32 double words (256 bytes). According to the check list a page erase must be performed first and then FSTPRG bit can be set to start the sequence.
I did not try this, but I suspect that I have to use the slower Standard programming sequence if I want program row 16 afterwards.
In the end the path of least resistance was to save the whole 2k page in SRAM and program it afterwards.
Best regards,
Pieter