As we know In-Application-Programming (IAP) is a feature of At91SAM chip in Due board, that means we can program the internal flash within our running code. Since IAP routine should be fetched and executed at ROM memory, then the programming the flash 0 (executing our code) is possible (the instruction fetching is from ROM, not from flash 0 inside of IAP invoking). And IAP, this name, should be meaningful. Otherwise, IAP is nothing different with manually using EEFC controller.
But the fact is that I found it is cannot write anything into flash 0 on Due board from within my code. I also check the security bit in GPNVM (0x2), the flash 0 is not secured, and set to start-up memory. And any commands for writing flash 0 (e.g. write, erase, set or clear the bit of GPNVM) is not possible, the IAP cannot return from calling. Any commands for reading flash 0 is perfectly working (e.g. get desciptor, lock bit, calibration bit and GPNVM bit).
Please note that the official manual of At91SAM (doc11057.pdf) is not correct for IAP address, that is stored at 0x00100008 (NMI vector), rather than 0x00800008. I succussfully tested several flash commands. Only cannot write anything into flash 0.
Anyone met the same problem? Is this related with the signals of pins, such as ERASE, TST etc. or it is related