Hello. I am trying to protect the first several pages in the QN9080 flash and am running into trouble with erasing unprotected pages. In order to test the problem, I have reduced the protection to a single page and the problem persists.
(Note: I have my flash mapped to address zero, so I am using address 0x00000000 as the start of page zero for this discussion.)
I have protected the page zero by writing 0xFFFFFFFE to address 0x0007F800.
I have disabled flash and memory protection by writing 0x00000001 to address 0x0007F820.
I am using SDK_2_.x_QN908XCDK version 2.2.0 (Manifest Version 3.0.0).
If I try to erase address 0x7000, which is page 14, the call to FLASH_PageErase (in fsl_flash.c) fails because the LOCKL_INT bit in FLASH>INT_STAT is set. However, the flash does get erased and the ERASEL_INT bit also gets set. I have seen the device erase multiple pages without any error, and then the LOCKL_INT bit will get on a subsequent erase. I haven't been able to find any pattern for this except that the LOCKL_INT bit will never get set if I do not protect any flash pages.
I have also found that if I clear the LOCKL_INT bit and try the erase again, the FLASH_PageErase function will not fail.
Why is the LOCKL_INT error bit getting set for unprotected pages, even though the erase succeeds?