Hello, and thank you for your replies!
This is the flash write time from our datasheet, this is where I have taken the 2.7ms from:

This, of course, supposing we would not do individual writes on entire pages, or banks...
I would recommend using PVD with a high-ish threshold (say 3V for a 3.3V rail). And keep the BOR at the lowest value. That way you have a window between 3V and 1.9V (or whatever you set the BOR to) to write to flash. You need enough holdup capacitance to have enough time, but it's certainly not hard to accomplish.
Ah, this would have been my proposed approach, but our SW Engineer is telling me that all interrupts are disabled during flash write operations, so that the micro would not be able to trigger the interrupt on the high-ish PVD threshold. I'll have to investigate if this is really the case; I have been looking through
AN4894 Application note EEPROM emulation techniques and software for STM32 microcontrollers, and whereas it does mention that
interrupts cannot be served during a maximum time equal to the longest page-erase operation duration, this only refers to the situation where the emulated EEPROM is in the same bank with the ISR code (
The provided implementation of the EEPROM emulation firmware runs from internal Flash memory, thus accesses to the same Flash bank are stalled during Flash erase or programming operations )
So I guess that if we are carefull and place the EEPROM emulation in a different bank from the interrupt service code, we could service the PVD interrupt.
Moreover, in the same application note they indicate in chapter 5.1.1 a key feature of this EEPROM emulation in the internal flash as being
possible interrupt servicing during program and erase operations. So I guess servicing interrupts during flash write operations should be somehow possible.
In the same app note I also came across some other interesting statement:
The EEPROM emulation software has been designed to be robust against power failures and fully asynchronous resets. Not sure what "robust" means, but it does not sound like a "guarantee".
Best regards,
Cristian