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.
I am getting a prefetch exception while trying to program the AJSM code register. I am executing the F021 library out of RAM and have been doing so for a while now without issues when flashing other places in flash. I am not currently using ECC, but I do notice that bits 27 and 27 of the auxiliary control are 1s. Here is the code I am using with debug print statements to do it.
sciInit(); uint32_t ajsm[4] = {0, 0xAECD0001, 0xAECD0002, 0xAECD0003}; copyFlashAPIIntoRAM(); initFlash(200.000F); Print("1\n\r"); while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady ); Print("2\n\r"); Fapi_StatusType status = Fapi_setActiveFlashBank(Fapi_FlashBank0);//???? if(status) { while(1); } Print("3\n\r"); while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady ); Print("4\n\r"); uint8_t banksMaks = 0xFF;//TODO: NOT SURE ABOUT THIS. should be bank 0 status = Fapi_enableBanksForOtpWrite(banksMaks); Print("5\n\r"); if(status) { while(1); } Print("6\n\r"); while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady ); Print("7\n\r"); status = Fapi_issueProgrammingCommand((uint32_t *)(0xF0000000), (uint8_t *)(&ajsm[0]), 16, NULL, 0, Fapi_AutoEccGeneration);//TODO: CHANGE TO ADD ECC TOO! Print("8\n\r"); if(status) { while(1); } Print("9\n\r"); while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady ); Print("10\n\r"); status = Fapi_disableBanksForOtpWrite(); Print("11\n\r"); if(status) { while(1); } Print("Success\n\r"); while(1);
I get the exception some time during the call to Fapi_issueProgrammingCommand(), but if I step through line by line it will not through an exception and also not make any change to the flash. After the exception is thrown, I check find the instruction fault status to be 0x409 and the instruction fault address 0xC.
Thanks in advance,
Westin
Okay, I got it working. I had commented out the while loop to wait until the FSM was no longer busy at the end, so it must have been returning to flash before it should have.