Tool/software: Code Composer Studio
I have an RM44L920 that works fine with the F021_API_CortexR4_LE_v3D16.lib, version 1.00. It is desired by the group to migrate to the latest 2.X version of the same library name.
I have complied and linked in the new library, and I have a snippit I got from the SPNA148.pdf erase/program app report that came with the distribution.
I'm trying to erase the first sector at 0x0 with this code, the call to Fapi_getFsmStatus is returning a success (0), but the flash is NOT erased. All oReturnChecks are coming back fine (Fapi_StatusFsmReady).
The Fapi functions are all located in this code section, this was done in V1.00. -
#pragma CODE_SECTION(Fapi_initializeFlashBanks, ".flashapi");
oReturnCheck = Fapi_initializeFlashBanks(180);
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
oReturnCheck = Fapi_enableMainBankSectors(Fapi_FlashBank0);
oReturnCheck = Fapi_checkFsmForReady();
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U; // Disable Level 1 Protection
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF; // Enable all sectors for erase and program.
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U; // Enable Level 1 Protection
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register = 0x5U; // Unlock FSM registers for writing
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFE0000; // Disable all sectors except sector 0
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U; // Execute the command
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0U; // Write address to FADDR register. This address must be within the bank to be erased
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_EraseBank; // Set command to ERASE
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U; // Execute the command
while (Fapi_checkFsmForReady() == Fapi_Status_FsmBusy)
{
DWDRESET();
}
FSM_Status = Fapi_getFsmStatus();