Here is how the program command sequence should look like:
Please attach a Logic analyzer to the flash interface to capture the flash traces. We need to check that the flash is receiving the right commands at the right time. I'm not clear about the parameters of your function nrf_drv_spi_transfer(). Please check these as well.
Additionally, the WIP can be stuck at 1 in case of a program or erase error. In that case the corresponding P_ERR or E_ERR bits in SR2V will be set accordingly. You need to check these bits as well and send a CLSR command to clear the Status Register WIP bit in case of error.
You need to send an erase command to erase the sector before reprogramming it (Program: changing bits from 1 to 0; Erase: changing back the bits from 0 to 1).
This happens when you send Erase/Program suspend command (75h) to the flash.
This looks quite suspicious since both bits are set at the same time and the WIP bit is still set to 1. I would expect the WIP to be reset to 0 once the P/E operations gets suspended.
Something suspicious is happening here. Only LA traces will help to solve it, as noted in my previous comment.
We are still waiting for the LA traces. Please send us so we can resolve the issue.
We have discover its caused by the device's interrupt issue. Therefore we would like to close this topics.