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.

TMS320F280045:Flash ECC calculation using Flash API

Other Parts Discussed in Thread: CCSTUDIO, ENERGYTRACE, SYSCONFIG

Dear Vamsi

I have still problems. No NMI problem; it is solved, but the ECC calulation is wrong.

This are the routines which not will cause any NMI Interrupt

static Fapi_FlashStatusType FlashProg_WriteEcc(uint32_t addr)
{
uint64_t data;
uint16_t ecc;
Fapi_StatusType fapiSts;
Fapi_FlashStatusType fapiFlashSts;
int16_t rv;
// uint32 eccAddress;

EALLOW;
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
EDIS;

EALLOW;
fapiFlashSts = Fapi_setActiveFlashBank(Fapi_FlashBank0);
EDIS;

data = *(uint64_t *) addr;
ecc = Fapi_calculateEcc(addr, data);

fapiSts = Fapi_issueProgrammingCommand((uint32_t *) addr, NULL, 0, &ecc, 1, Fapi_EccOnly);

while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);


if (fapiSts == Fapi_Status_Success)
{
fapiFlashSts = Fapi_getFsmStatus();

rv = 0;
}

ASSERT(fapiFlashSts == 0);
ASSERT(fapiSts == Fapi_Status_Success);
return rv;
}

/**
* @brief program ECC call after programming with Fapi_DataOnly option
* @param addr. range
* @retval status
*/
Fapi_FlashStatusType CalculateAndWriteEcc(uint32_t BlockAdrStart, uint32_t BlockAdrEnd)
{
uint32_t addr;
Fapi_FlashStatusType rv;

addr = BlockAdrStart;
rv = 0;

while ((addr <= BlockAdrEnd) && (rv == 0))
{
rv = FlashProg_WriteEcc(addr);
addr = addr + 4;
}
return rv;
}

This is Memory Content:

0x00080000 4800 F328 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

This ECC Content with emulator programmed

0x1080000 
FFB6 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

This is calculation with my routines:

0x01080000 00A1 0021 003C 00AD 0039 00A8 00B5 0024 0036 00A7 00BA 002B 00BF 002E 0033 00A2

I checked this line workingf fine:

data = *(uint64_t *) addr; //data has expected content addr is also ok.

ecc = Fapi_calculateEcc(addr, data); 

calculated ecc is equal to memory content on 0x1080000

So basically the routine is working. Only the result from Fapi_calculateEcc seems to be wrong

Hope you have now the information to really give me the hint I need to solve the problem.

Thanks

Franz

  • Franz,

    Glad that NMI issue is resolved.

    Regarding the ECC value calculated by Fapi_calculateEcc(): For the 64-bit data 0xFFFFFFFFF3284800 (0x4800, 0xF328, 0xFFFF, 0xFFFF) and the address 0x80000, the corresponding ECC value iv 0xA1.  I verified this to be correct.

    Not sure why you are saying that it is incorrect?

    You said that the "ECC content with emulator programmed" is 0xB6. Can you give more details on this?  Did you use CCS to program the data and got this ECC value?  Can you share the project and the CCS version # and CCXML that you used?

    Thanks and regards,
    Vamsi

  • Dear Vamsi

    Attached you find 2 Files. Emulator00.txt is loaded with CCS Version: 8.3.1.00004 and Signum JTag Emulator. This program (find file attached) is working fine. Also after reset without emulator.

    sci00.txt is loaded with my seriell downloader. You see content of flash is equal, but the ECC calculation is different. You find the ECC and flash memory in these 2 files. After reset the program in flash is not start up.

     

    Here the full CCS information:

    Analysis Suite 4.1.0.201810301124 com.ti.dvt2.analysis.suite.feature.group Texas Instruments
    ARM Compiler Help 18.1.0.20181119225258 com.ti.arm.18.1.help.feature.group Texas Instruments
    ARM Compiler Tools 18.1.6 com.ti.cgt.tms470.17.win32.feature.group Texas Instruments
    Blackhawk CCSv6.2 Emulation Update 6.2.0.011 com.bh.ccstudio.emulation.win32.feature.group Blackhawk
    C/C++ Development Tools 9.4.3.201802261533 org.eclipse.cdt.feature.group Eclipse CDT
    C/C++ GCC Cross Compiler Support 9.4.3.201802261533 org.eclipse.cdt.build.crossgcc.feature.group Eclipse CDT
    C/C++ Memory View Enhancements 9.4.3.201802261533 org.eclipse.cdt.debug.ui.memory.feature.group Eclipse CDT
    C/C++ Remote Launch 9.4.3.201802261533 org.eclipse.cdt.launch.remote.feature.group Eclipse CDT
    C2000 Compiler Help 18.1.0.20180221222139 com.ti.c2000.18.1.help.feature.group Texas Instruments
    C2000 Emulation Flash 1.0.0.5 com.ti.c2800.flash.feature.group Texas Instruments
    C2800 Compiler Tools 18.1.6 com.ti.cgt.c2000.17.win32.feature.group Texas Instruments
    CCS and SAT Common Components Feature 8.2.0.201810301800 com.ti.tools.common.feature.group Texas Instruments
    CCS Documentation 8.3.1.201904019 com.ti.ccstudio.doc.win32.feature.group Texas Instruments
    CCS Launcher 8.1.0.20180404 com.ti.ccstudio.launcher.win32.feature.group Texas Instruments
    CCS Utilities 1.0.0.20160210 com.ti.ccstudio.utils.cli.win32.feature.group Texas Instruments
    CCStudio p2 Tool Feature 7.0.0.201611291427 com.ti.ccstudio.p2tool.feature.group Texas Instruments
    CCSv8 Service Release Windows 8.3.1.00004 com.ti.ccstudio.installer.win32.feature.group Texas Instruments
    Chromium Browser Feature 8.2.0.201810301800 com.ti.chromium.browser.feature.group Texas Instruments
    Code Composer Studio Base Components 8.3.0.01611 com.ti.ccstudio.base.feature.group Texas Instruments
    Code Composer Studio IDE ARM Components 8.3.0.201810301800 com.ti.ccstudio.tms470.feature.group Texas Instruments
    Code Composer Studio IDE C2000 Components 8.3.0.201810301800 com.ti.ccstudio.c2000.feature.group Texas Instruments
    Code Composer Studio IDE Main Feature 8.3.0.201810301800 com.ti.ccstudio.idemain.feature.group Texas Instruments
    Code Composer Studio IDE Workflow 8.2.0.201810301800 com.ti.ccstudio.workflow.feature.group Texas Instruments
    Compiler Tools On-line Documentation 1.1.5 com.ti.cgt.dmed.win32.feature.group Texas Instruments
    Debug Server 8.3.0.1611 com.ti.ccstudio.debugserver.win32.feature.group Texas Instruments
    Debug Server Flash 8.3.0.1611 com.ti.dsflash.win32.feature.group Texas Instruments
    DVT - EnergyTrace 4.1.0.201810301124 com.ti.dvt.energytrace.feature.group Texas Instruments
    DVT - Graph Visualization 4.1.0.201810301124 com.ti.dvt2.graph.visualization.feature.group Texas Instruments
    DVT - Profiler Analysis Manager 4.1.0.201810301124 com.ti.dvt2.profileanalysismanager.feature.group Texas Instruments
    DVT - Resource Explorer 4.1.0.201810301124 com.ti.dvt2.resource.explorer.feature.group Texas Instruments
    DVT - System Analyzer 4.1.0.201810301124 com.ti.dvt2.uia.feature.group Texas Instruments
    DVT - Trace Control 4.1.0.201810301124 com.ti.dvt2.trace.control.feature.group Texas Instruments
    Eclipse Help System 2.2.103.v20180301-0715 org.eclipse.help.feature.group Eclipse.org
    Eclipse Platform 4.7.3.M20180301-0715 org.eclipse.platform.ide Eclipse.org
    Equinox p2, Discovery UI support 1.1.1.v20170906-1259 org.eclipse.equinox.p2.discovery.feature.feature.group Eclipse.org - Equinox
    Equinox p2, Provisioning for IDEs. 2.3.2.v20171108-1343 org.eclipse.equinox.p2.user.ui.feature.group Eclipse.org - Equinox
    GCC ARM Compiler Tools 7.2.1.2017-q4-major com.ti.gcc.arm.win32.feature.group Texas Instruments
    GEF (MVC) 3.11.0.201606061308 org.eclipse.gef.feature.group Eclipse GEF
    Git integration for Eclipse 4.9.2.201712150930-r org.eclipse.egit.feature.group Eclipse EGit
    Graphical Modeling Framework (GMF) Runtime Third-Party Components 1.11.0.201706061437 org.eclipse.gmf.runtime.thirdparty.feature.group Eclipse Modeling Project
    GUI Composer Backplane Feature 8.2.0.201810301800 com.ti.gc.backplane.feature.group Texas Instruments
    GUI Composer Program Model Feature 8.2.0.201810301800 com.ti.gc.pm.feature.group Texas Instruments
    IDE - Debug Server Integration Feature 8.2.0.201810301800 com.ti.debug.server.feature.group Texas Instruments
    Image Analyzer 4.1.0.201810301124 com.ti.dvt2.via.ccs.feature.group Texas Instruments
    Marketplace Client 1.6.4.v20180214-1810 org.eclipse.epp.mpc.feature.group Eclipse Marketplace Client
    Node.js 8.11.1 com.ti.ccstudio.nodejs.win32.feature.group Texas Instruments
    p2appf 8.2.0.201810301800 com.ti.ccstudio.p2appf.feature.group Texas Instruments
    Remote System Explorer End-User Runtime 3.7.3.201704251225 org.eclipse.rse.feature.group Eclipse TM Project
    ROV 4.1.0.201810301124 com.ti.dvt2.rov.feature.group Texas Instruments
    RTSC/XDCtools (IDE Client) 3.51.1.18 org.eclipse.rtsc.xdctools.product.ui.feature.group Texas Instruments
    RTSC/XDCtools (Target Runtime Support) 3.51.1.18 org.eclipse.rtsc.xdctools.product_3.51.1.18.feature.group Texas Instruments
    RTSC/XDCtools (Target Runtime Support) 3.50.8.24 org.eclipse.rtsc.xdctools.product_3.50.8.24.feature.group Texas Instruments
    RTSC/XDCtools (Target Runtime Support) 3.32.2.25 org.eclipse.rtsc.xdctools.product_3.32.2.25.feature.group Texas Instruments
    RTSC/XDCtools (Target Runtime Support) 3.31.3.43 org.eclipse.rtsc.xdctools.product_3.31.3.43.feature.group Texas Instruments
    RXTX End-User Runtime 2.1.8.0_201606281300 gnu.io.rxtx.feature.group RXTX.org
    Spectrum Digital Emulators 5.2.0.14 com.sd.ccstudio.emulation.win32.feature.group Texas Instruments
    Sys Config 1.0.559 com.ti.ccstudio.sysconfig.feature.group Texas Instruments
    TargetDB Default Props 8.3.0.N201810301800 com.ti.ccstudio.targetdb.props.default.win32.feature.group Texas Instruments
    TI C2000 Device Support 5.0.0.0 com.ti.c2000.support.win32.feature.group Texas Instruments
    TI Cloud Agent 0.5.1463 com.ti.ccstudio.cloudagent.win32.feature.group Texas Instruments
    TI Emulators 8.3.0.00003 com.ti.emulation.pack.win32.feature.group Texas Instruments
    TI Emulators Plugin 1.0.4.201907171303 com.ti.dbgtrc.webapp Texas Instruments
    TI Target Content 1.0.0.201811251509 com.ti.targetcontent.feature.group Texas Instruments
    TIREX Desktop 3.7.0.201903271703 com.ti.tirex.feature.group Texas Instruments
    Tiva C Series ARM MCUs 2.1.1.15071 com.ti.tiva_tm4c.setup.win32.feature.group Texas Instruments
    Tiva E Series ARM MCUs 2.1.1.15071 com.ti.tiva_tm4e.setup.win32.feature.group Texas Instruments
    Tiva/Stellaris ICDI Debug Probe 2.1.3.15 com.ti.tiva_stellaris.setup.win32.feature.group Texas Instruments
    TM Terminal 4.3.0.201706140544 org.eclipse.tm.terminal.feature.feature.group Eclipse.org - Target Management
    TM Terminal Serial Connector Extensions 4.3.0.201706140544 org.eclipse.tm.terminal.connector.cdtserial.feature.feature.group Eclipse.org - Target Management
    Trace Analyzer 4.1.0.201810301124 com.ti.dvt2.trace.ccs.feature.group Texas Instruments
    XDAIS (IDE Client) 7.24.0.04 com.ti.rtsc.XDAIS.product.ui.feature.group Texas Instruments Inc.
    XDAIS (Target Content) 7.24.0.04 com.ti.rtsc.XDAIS.product_7.24.0.04.feature.group Texas Instruments Inc.
    XDCtools Core Update Feature 3.32.2.25 com.ti.xdctools_3_32.update.feature.group Texas Instruments

    Hope this will help you.

    Thanks for support.

    Franz

    SignumTMS320F28004x.zip

     

  • Franz,

    For the 64-bit data 0xFFFFFFFFF3284800 (0x4800, 0xF328, 0xFFFF, 0xFFFF) and the address 0x80000, the corresponding ECC value is 0xA1.

    For the 64-bit data 0xFFFFFFFF28F30048 (0x0048, 0x28F3, 0xFFFF, 0xFFFF) and the address 0x80000, the corresponding ECC value is 0xB6.

    You have LSB and MSB swapped. ECC is calculated accordingly.

    Thanks and regards,
    Vamsi

  • Franz,

    I reviewed your other post.  For Serial case, I think you are calculating the ECC for the swapped bytes, since the boot data stream structure requires LSB first and then the MSB.  Please check.

    Thanks and regards,
    Vamsi  

  • Dear Vamsi

    Thank you for help. Now I have the solution which is working. Here you can find my flash programming routine which do not prog the ECC. And also the ECC programming routine. 

    /**

    * @brief calculate and program ECC only for 8 Words

    * @param addr.

    * @retval none

    */

    static Fapi_FlashStatusType FlashProg_WriteEcc(uint32_t addr)

    {

       uint64_t               data;

       uint16_t               ecc, ecc1;

       Fapi_StatusType         fapiSts;

       Fapi_FlashStatusType   fapiFlashSts;

       int16_t                 rv;

     

       EALLOW;

       Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;

       EDIS;

     

       EALLOW;

       fapiFlashSts = Fapi_setActiveFlashBank(Fapi_FlashBank0);

       EDIS;

     

       data = *(uint64_t *) addr;

       if (data != 0xFFFFFFFFFFFFFFFF)

           ecc = Fapi_calculateEcc(addr, data);

       else // data Field unused --> ECC is 0xFF

           ecc = 0xFF;

     

       data = *(uint64_t *) (addr+4);

       if (data != 0xFFFFFFFFFFFFFFFF)

           ecc1 = Fapi_calculateEcc(addr+4, data);

       else // data Field unused --> ECC is 0xFF

           ecc1 = 0xFF;

     

       ecc = (ecc & 0xFF) + (ecc1 << 8);

     

       // if (addr > 0x81000)

    //     __asm("   ESTOP0");

       fapiSts = Fapi_issueProgrammingCommand((uint32_t *) addr, NULL, 0, &ecc, 2, Fapi_EccOnly);

     

       while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);

     

     

       if (fapiSts == Fapi_Status_Success)

       {

           fapiFlashSts = Fapi_getFsmStatus();

           rv = 0;

       }

     

       ASSERT(fapiFlashSts == 0);

       ASSERT(fapiSts == Fapi_Status_Success);

       return rv;

    }

     

    /**

    * @brief program ECC call after programming with Fapi_DataOnly option

    * @param addr. range

    * @retval status

    */

    Fapi_FlashStatusType CalculateAndWriteEcc(uint32_t BlockAdrStart, uint32_t BlockAdrEnd)

    {

       uint32_t       addr;

       Fapi_FlashStatusType         rv;

     

       addr = BlockAdrStart;

       rv = 0;

     

       while ((addr <= BlockAdrEnd) && (rv == 0))

       {

           rv = FlashProg_WriteEcc(addr);

           addr = addr + 8;

       }

       return rv;

    }

     

    /**

    * @brief program 1..8 16 Bit Word in uP flash ECC will not be written

    * @param BlockAdr:

    * @retval status

    */

    Fapi_FlashStatusType FlashProgramm(unsigned int * BlockAdr, uint16 * ui16ProgBuffer, uint16 BlockLength)

    {

       uint16 ui16Proglength = 0;

       uint32 test;

       while (BlockLength > 0)

       {

         if ( (*BlockAdr & 0x00000007) == 0)     //Entweder innerhalb 128 Bit oder bündig zu 128 Bit Block

         { //bündig zu 128 Bit Block

             if (BlockLength >= 8)

                 ui16Proglength = 8;

             else

                 ui16Proglength = BlockLength;

             BlockLength -= ui16Proglength;

         }

         else //nicht bündig --> Word weise bis zum 128 Bit Block Ende programmieren

         {

     

           test = BlockAdr;   //Wieso diesen Umweg? direkt geht nicht

           test = test & 0x07;

           ui16Proglength = 8-test;

           if (BlockLength < ui16Proglength)

               ui16Proglength = BlockLength;

           BlockLength -= ui16Proglength;

         }

     

          Fapi_issueProgrammingCommand( (uint32 *) BlockAdr,

                                       (uint16 *) ui16ProgBuffer,

                                       (uint16) ui16Proglength,

                                       0,

                                       0,

                                         Fapi_DataOnly);

         // Wait until the Flash program operation is over

         while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);

         BlockAdr += ui16Proglength;

         ui16ProgBuffer += ui16Proglength;

       }

       return Fapi_getFsmStatus();

    }

    This is the call from main for ECC progamming:

    CalculateAndWriteEcc(Bzero_Sector0_start, Bone_Sector15_start + 2*Sector8KB_u32length -1);

    Franz

  • Franz,

    Glad that it helped.

    I did not go through your code in your latest reply since you said it is working now.

    Please note for future: Instead of copying the code in to the post, please attach the code file if needed.

    I am closing this post.

    Thanks and regards,
    Vamsi