2023-12-01 06:12 PM
Greetings,
We are adding an OTA procedure to our firmware that depends on a small loader at the start of flash which is responsible for programming the main application written to program flash at a higher address. The procedure works fine as it is, except that we are not finding it possible to use the Fast Programming feature.
According to the RM, before FSTPG programming can be used, the device must be mass erased. Yet, CPU1 is not permitted to perform this operation. We suspect that it may be possible to execute a mass erase from the C2 coprocessor, which could be acceptable, however, we don't want to lose the loader. The WRP bits in the option bytes would protect the loader...except that the documentation explains that setting WRP precludes any mass erase.
So, our question is this. Is there a way we can use FastProgramming from the user application code to improve the speed of programming our firmware?
FWIW, we checked the Cube sources and this code is doing the same thing we are. When we initiate the programming sequence, the MCU returns error code bits for FPRGERR, PGSERR and PGAERR.
Cheers
2023-12-01 06:35 PM - edited 2023-12-01 06:35 PM
> Is there a way we can use FastProgramming from the user application code to improve the speed of programming our firmware?
Without losing your loader in flash, no.
However, it would be possible to store your OTA code in RAM and execute from that. With it comes the risk of losing loader functionality on the device if the power gets interrupted during the update.
Generally, waiting a few extra seconds for flashing to complete is a relatively minor inconvenience. Erasing is typically the bulk of the time.
2023-12-01 06:41 PM
Thanks for the quick reply.
Yes, it's not terribly long. We always get asked to make it faster, so it's helpful to have an explanation.
Cheers