Hello, and welcome to the forum.
Yes, you need to do these things to erase or program flash memory. However, according to the datasheet, the FCMD register is write only, and will always read as 0x00.
I do not understand your second question. Perhaps providing a snippet of your code may help you to describe your problem.
Regards,
Mac
I sovled this question later,it's because that you must write a code of writing data and address before write the register FCMD.
But I need to do with another new question,I have not add watchdog in my main(),and I used 0x25 (constant writing).If I excute the program step by step ,it will be OK.But when I excute it wholy in once,the program will ran away.it will run to 0xbd ,0xc0.
I want to know ,where is the problem. anyone could support a help?thank you.