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.

Show FaultISR when ROM_FlashErase...

Other Parts Discussed in Thread: TM4C129ENCPDT

Hi, all

My chip is TM4C129ENCPDT with CCS 5.4.00091, library  is TivaWare_C_Series-2.0.1.11577

The following is my code, when call ROM_FlashErase, it always receive a fault interrupt.

Does anyone know how to solve this issue?

UARTprintf("Start erasing flash(0x%x~0x%x)...\n",_uiStartAddr,_uiStartAddr + g_sFileInfo.fsize);
ui32EraseTotalCnt = g_sFileInfo.fsize / 1024;
for(ulIdx = _uiStartAddr; ulIdx < _uiStartAddr + g_sFileInfo.fsize; ulIdx += 1024)
{
    //ui32EraseCnt +=1 ;
    //uiProgress = (50*ui32EraseCnt) / ui32EraseTotalCnt;
    //SetProgramProgress(uiProgress);
    ROM_FlashErase(ulIdx);
}
UARTprintf("Finish erasing flash...\n");

  • Hello Tu,

    Please answer the following questions and view the comments

    1. Which revision of the device is being used? It would be there as a marking on the device I1, I2 or I3?
    2. The Sector size of the device is not 1024 Bytes but 16KB on TM4C129. So you would need to re-adjust the for loop.

    Regards
    Amit
  • Hi, Amit Ashara

    Thanks your help, I follow your suggestion, use 16KB erase(128 bytes), and CCS shows FaultISR again...

    The following picture is my cpu, I hope it will be helpful to you.

  • Hello Tu,

    Thanks for the image. That will help me narrow down my search on any know issue.

    If you replace the ROM_FlashErase with FlashErase does it behave the same manner. (I would be able to run a sample code to execute code from lower 512K and ROM_FlashErase upper 512KB only tomorrow, so may be this can help you to WA the issue)

    Also, what I did notice was that the code execution faulted at 0x7ADC4 which means that there is code in the higher region of the lower 512KB of flash. Could it be possible that there is an interrupt which caused the CPU to go to 0x80000+ region and hence result in a fault?

    Regards
    Amit
  • Hi, Amit Ashara

    I have replace the ROM_FlashErase with FlashErase, and the behave has the same manner, shows FaultISR again.

    Hmm...Perhaps there is an interrupt when erase the flash, because I have enable some timers...So I should disable all the timers to avoid interrupt before call rom_flasherase?

  • Hello Tu,

    Where is the Interrupt Vector mapped. You can check in the VTABLE register at 0xE000ED08. If it is still mapped to the 0x80000+ address space when a Erase is taking lace then it could be the problem.

    We have tested Flash Program and Erase while running from Flash on TM4C129 (there was a long contested post on the forum for EEPROM Program Erase time).

    Regards
    Amit
  • Hi, Amit Ashara

    I have checked the VTABLE register at 0xE000ED08, the register value is 0x00024000 and never change, not only call ROM_FlashErase before(after), but also shows the FaultISR)

  • Hello Tu,

    OK, so interrupt vector map is not the issue here. What is the new COM Port display?

    Regards
    Amit
  • Hi, Amit Ashara

    I found it, the error is my app address is 0x24000 in flash, in main code, I have changed the NVIC_VTABLE at 0x24000

    The following is my code.

    int main(void)
    {
        //
        // Set the clocking to run directly from the external crystal/oscillator.
        // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
        // crystal on your board.
        //
        //-------------------------------------------------------------------------
        //HWREG(NVIC_VTABLE) = 0x0;//<--APP Start Address
        HWREG(NVIC_VTABLE) = APP_START_ADDRESS;//0x24000
    
        IntMasterEnable();
    
        //
        // Enable stacking for interrupt handlers.  This allows floating-point
        // instructions to be used within interrupt handlers, but at the expense of
        // extra stack usage.
        //
        ROM_FPUEnable();
        ROM_FPUStackingEnable();
    
    
        g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                                               SYSCTL_CFG_VCO_480), 40000000);
    
        UARTStdioConfig(3,115200,g_ui32SysClock);
    
        .....
    }

    If I change the app address to 0x0 in flash under *.cmd file, and change the NVIC_VTABLE to 0x0, the ROM_FlashErase API will never show the FaultISR...

    Because of some reason, my code should locate at 0x24000 in flash (the address 0x0 is uart_bootloader, 0x10000 is usb_stick_update), so I have no idea to fix this issue, do you know how to solve this issue?

  • Hello Tu

    Is the boot loader calling the ROM_FlashErase or the Application code calling the same?

    Regards
    Amit
  • Hi, Amit Ashara

    I have found my error, the application is large so ROM_FlashErase erased my application.

    Thanks for your help :-)

  • Hello Tu,

    If the boot loader is calling the ROM_FlashErase then the NVIC Table address must point to the Boot Loader (0x0) and not to the application code. Also before going to the boot loader, it is a must to disable all the interrupts in the NVIC, so that all Flash Erase and Program operations do not get interrupted.

    Regards
    Amit