We are trying to program the MCU flash memory to write and save some data on it. After a single write to a single sector(that might have failed), when we try to write/overwrite the same sector we fail. We are using HAL_FLASHEx_Erase to delete the sector. In particular, we use the ideas in this article https://controllerstech.com/flash-programming-in-stm32/
Looking for advice on how to proceed from here/ things to think about that we might have missed. Thanks in advance.