Hi Mark,
Thanks for your reply.
I followed your advice and added SCB_CleanDCache(); right after the programming operation to flush the cache but it does not seem to change anything unfortunately.
To give you some clarifications, my code is divided in two parts: a bootloader and an application.
I also reserved a sector in flash (in the linker script) for sharing data between bootloader and application.
There is no problem when I write data to flash from the bootloader or the application separately.
The issue comes when I try to write something into the "shared data" sector (at 0x7003F000) from the bootloader whereas the application already wrote something at that space before jumping to the bootloader (via a software reset).
I also get the same issue in the other way: when I try to write something from the application at an address that was written by the bootloader before jumping to application.
But the thing is I can write once, without any problem.
Before writing I ensure to erase the entire 4KB sector and write by pages of 256B, but I found out this is the erase operation that does not seem to erase properly in the cases I described before.
Have you already met some behavior like this one?
Thanks a lot!
Paul