Thank you very much for your response. It was very helpful.
I looked at the example code you recommended.
In the case of a flash program, I understood that the first write to the Flash address to be written is interlock write.
For flash erase, there are a few questions to help you understand.
(It is assumed that the flash lock is unlocked.)
1) When erasing, I understood that the value of write interlock does not have to be 0xFFFF_FFFF. Is that correct?
2) When erasing, the address of interlock write should be the address of the area to be erased. Should the address of the area you always want to erase be the first area?
Example ----> For L1 area (0x0000_4000 ~ 0x0000_8000)
1. *((unsigned int *)0x00000000) = any_value; // interlock write
2. *((unsigned int *)0x00004000) = any_value; // interlock write
In the case of L1, which is 1 or 2?
Or, if it is flash area (0x0000_0000 ~ 0x0038_FFF0), is it okay?
3) If there are multiple areas to be erased (when MSEL and LSEL are all selected in FLASH_x_LMSR), where should the area of the interlock write address be selected?
Your answers are very helpful for beginners.
Thank you.