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.

Flash021 API

Other Parts Discussed in Thread: TMS570LS3137, CODECOMPOSER

Hi,

Hi , I want to write to data on EEPROM so, using F021 flash API. I downloaded necessary file and add to this file on my project.(F021.h vs.  and .lib file) but I have a trouble when compiling.. **** "  Problem : #16016 file " ** ***    I use  Tms570ls3137 and  codeComposer : 5.1.1.0031

  • Hans,

    Take a look at the attached example for using TI Flash API. EEPROM bank is bank 7.

    7167.F021_Program.c

    Thanks and regards,

    Zhaohong

  • Thank you Zhaohong,

    How can i read this data on EEPROM.Can  you  give me code thank you.. 

  • Hans,

    You can read EEPORM bank in the same way as reading from RAM or Flash main bank.

    Thanks and regards,

    Zhaohong

  • Zhaohong,

    in F021 document, in this code:

    #include “F021.h”


    int main (void)
    {
    Fapi_StatusType oReturnCheck = Fapi_Status_Success;
    FwpWriteByteAccessorType * oFwpWriteByteAccessor = FWPWRITE_BYTE_ACCESSOR_ADDRESS;
    FwpWriteByteAccessorType * oFwpWriteEccByteAccessor = FWPWRITE_ECC_BYTE_ACCESSOR_ADDRESS;
    FwpWriteDWordAccessorType * oFwpWriteDWordAccessor = FWPWRITE_DWORD_ACCESSOR_ADDRESS;
    uint8 au8MainDataBuffer[16] = {0x78, 0x17, 0x19, 0x2E, 0x0A, 0xB9, 0x11, 0x70,
    0x5F, 0xC1, 0x9C, 0xFD, 0x54, 0x51, 0xED, 0x86};
    uint32 u32Index;
    /*
    For proper initialization of the device prior to any Flash
    operations,
    see the device-specific initialization document.
    Assumes, unless otherwise noted, device has 144bit wide Flash Banks.
    */
    oReturnCheck = Fapi_initializeFlashBanks(180); /* Example code is assuming operating
    frequency of 180 MHz */
    if((oReturnCheck == Fapi_Status_Success) &&
    (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy != Fapi_Status_FsmBusy))
    {
    oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
    /* Place specific example code here */
    /* Wait for FSM to finish */
    while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy == Fapi_Status_FsmBusy);
    /* Check the FSM Status to see if there were no errors */
    if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
    {
    /* Put Error handling code here */
    }
    }
    }

    while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy == Fapi_Status_FsmBusy); -> in this code, program wait for FSM to finish..

    İf FSM is not finish, Will Program locked  ?

  • Hans,

    For the code you attached, CPU will be locked to the instruction if FSM stays busy forever. It is an indicator that something is wrong. You may consider that following so that CPU is not locked when there is an error.

    unsigned int K = 0xffffffff, flag =0;

    while( flag ==0 )

    {

        if(FLASH_CONTROL_REGISTER->FmStartFMSTAT_BITS_Busy == Fapi_Status_FsmBusy)

        {

            K=K-1;

         }

        else

       {

            flag = 0;

        }

    }

    K = 0 indicates an error.

    Thanks and regards,

    Zhaohong


    while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy == Fapi_Status_FsmBusy)

  • Hi Zhaohong

    Thank you so much..