Tool/software:
In this FAQ, i will explain how to write into flash bank-0
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
To write anything into the flash bank-0 we need to make sure the two things.
1. We should execute the all the FAPI routines into the RAM because "The F021 Flash API library cannot be executed from the same bank as the active bank
selected for the API commands to operate on. On single bank devices, the F021 Flash API must be executed from RAM."
For more details refer below thread once:
2. Not just FAPI routines but the status verification related functions should also execute from RAM only.
For example:
We are executing Fapi_issueAsyncCommandWithAddress and Fapi_issueProgrammingCommand functions in RAM that is fine however their corresponding status verification is still present in the flash.
That is:
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
The above two lines are still executing in flash, this is creating issue because after initiating erase or write operation commands to the one of the flash banks then we should not execute any code in the same flash bank until the issue command operation is completed. If we access same flash bank before completion of the operation that will create exception.
So same thing is happening in your case as well. So, the solution here is that the status checking instructions for operations erase and program should also happen in RAM not in the flash.
If we make sure these things we can easily write code into the flash bank-0
Here is an example project for the same: