I am working on flash bootloader on xdg128.
For communication with bootloader I am using serial port with interrupt.
But if I dont disable interrupt while actual flash read/write operation are going on the code hangs.
As per program flow chart for xdg128(as mentioned in datasheet), nothing is written about disabling interrupt.
Also as per flowchart if i check CBEIF bit for writing next word, writing fails. It works if some delay is given between them.
Why so.
Flash memory is not readable while any flash command is in progress (erase, blank check, program etc). You need to disable interrupts before, and reenable them only after flash command is complete. Also part of your flashing code, which clears CBEIF and waits until CBEIF is set, should execute from RAM or another memory, which is readable while flash is being programmed, erased etc.