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.

CCS/TMS570LS0432: F021 Flash API not working

Part Number: TMS570LS0432

Tool/software: Code Composer Studio

Hi,

Recently I have been trying to develop a bootloader for the TMS570. I can get the CAN communication working and can get said communication to save to Bank 7 using the FEE driver however, whenever I attempt to use the F021 API Fapi functions outside of the FEE driver I get an undefentry interrupt called followed by an error saying that the function document cannot be found.

I have linked the API properly using the appropriate linker library however, no matter what I do I always get the same error even when I attempt to initialize the Fapi Bank.

Any help would be greatly appreciated. 

Here is my code used for the flash writing I'd like to do:

uint32_t Fapi_UpdateStatusProgram( uint32_t Bank, uint32_t Flash_Start_Address, uint32_t Data_Start_Address, uint32_t Size_In_Bytes)
{
    register uint32_t src = Data_Start_Address;
    register uint32_t dst = Flash_Start_Address;
    unsigned int bytes, status = 0;
    Fapi_StatusType oReturnCheck = Fapi_Status_Success;

    if (Size_In_Bytes < 16)
        bytes = Size_In_Bytes;
    else
        bytes = 16;

    Fapi_initializeAPI((Fapi_FmcRegistersType *)F021_CPU0_REGISTER_ADDRESS, (uint32_t)SYS_CLK_FREQ);
    oReturnCheck= Fapi_initializeFlashBanks(10); //10Mhz
    if((oReturnCheck == Fapi_Status_Success)){
        oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
        //while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy == Fapi_Status_FsmBusy);
        delay();

    }
    //delay();
    Fapi_setActiveFlashBank((Fapi_FlashBankType)0);
    Fapi_issueProgrammingCommand((uint32_t *)dst,
                                     (uint8_t *)src,
                                     (uint32_t) bytes,   //8,
                                     0,
                                     0,
                                     Fapi_AutoEccGeneration);

    while( Fapi_checkFsmForReady() == Fapi_Status_FsmBusy );
    status =  Flash_Program_Check(Flash_Start_Address, Data_Start_Address, Size_In_Bytes);
    delay();
    return (status);
}

Thanks,

Ron Haber

  • Hi Ron,

    In the F021 API V2.00 and later version, the Fapi_initializeAPI(..) function is replaced with Fapi_initializeFlashBanks(..). So please comment out the function call of Fapi_initializeAPI(..).

    Fapi_initializeFlashBanks() must use the system clock frequency (HCLK) in MHz. What is the HCLK (up to 80MHz) in your application? I noticed that you use 10MHz in Fapi_initializeFlashBanks(..).
  • Hi QJ,

    I commented out the line as you described but I am now receiving a prefetchentry interrupt in my code.

    Thanks,

    Ron
  • Ron,

    Fapi_initializeFlashBanks() must use the system clock frequency (HCLK) in MHz. I noticed that the 10MHz is used. Is the HCLK in your configuration 10MHz? I remember that the OSCIN in your application is 10MHz, so I guess you don't use PLL and use OSCIN for GCLK/HCLK/VCLK etc.