You then need to write programming data to a desired FLASH address. To execute the one-byte program operation, write a hex value $20 to the FCMD register.
After a command is sent, wait at least four bus cycles and then clear FCBEF. Check for error flags and the FCFF bit. If one of the error flags is set, the user must take an appropriate action in the user software. If no flags are set, wait until the FCCF bit is set. This flag indicates that the operation is complete.
I did not expect the phrase "... wait at least four bus cycles and then clear FCBEF". I might have expected the phrase "... set FCBEF to launch the command, and then wait at least four bus cycles". Well, that was my prior understanding of the process.
3) The latter part of the same paragraph, which is also supported by the flow diagram, seems to be saying that the error flags must be tested whilst waiting for the FCCF flag bit to become set. This may well imply that the FCCF flag may never become set should an error be present. If this is true, some of the recently posted code examples could enter an endless loop, since they do not test the error flags until after exiting the "wait for FCCFset" loop.
It would seem that a definitive answer is required for the following question -
Following the launch of a flash command by setting the FCBEF bit within FSTAT, does the FCCF bit always eventually become set, irrespective of whether a FACCERR or FPVIOL error occurs?
Regards,
Mac