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.

ECC calculation on the TMS470M

Hi,

does anyone know if the Fapi_HardwareCalculateEcc function works on the TMS470M? I am using the API 1.06, which is the latest off the website.

I have run the function on 16 bytes, 4 32bit words, and the resultant ECC words returned appear to be the same, regardless of the data that I have programmed into the memory.

If the ecc function does not support the TMS470M processor, where can I find the algorithm so that I can create my own function to calculate the ECC?

thanks for the help, I am away for 2 weeks, so if I won't reply back until I return.

regards,

Phil

  • Phil,

    Would you please send your test code for us to take a look?

    Thanks and regards,

    Zhaohong

  • Hi, very much a work in progress, but the code below will show the settings I am using for the ECC.

    uint16_t hal_flash_write( flash_sp_memory_t mem, uint32_t address, uint32_t count, uint8_t* buffer )
    {
    /* for ecc test */
    uint16_t ecc[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };

    uint16_t result = ERRORCODE_DSP_FLASH_FAIL;
    bool_t write_result = FALSE;
    bool_t verify_result = FALSE;
    FAPI_ERROR_CODE ecc_result = FALSE;
    FLASH_STATUS_ST the_status;


    FLASH_ARRAY_ST control = (FLASH_ARRAY_ST)0xfff87000;
    the_status.stat1 = 0x00000000;
    the_status.stat2 = 0x00000000;
    the_status.stat3 = 0x00000000;
    the_status.stat4 = 0x00000000;

    /* write the data */
    write_result = Flash_Prog_Data_B( (uint32_t * )(address),
    (uint32_t*)buffer,
    count / 4,
    0,
    delay,
    control,
    &the_status,
    count / 4,
    CMND_PROG_DATA_MAIN
    );

    ecc_result = Fapi_HardwareCalculateEcc( (uint32_t * )(address),
    &ecc[0],
    count/4,
    control

    );

    if ( write_result == TRUE )
    {
    /* program the ecc bits. */




    /* verify that the data is correct */
    verify_result = Flash_Verify_Data_B((uint32_t * )(address),
    (uint32_t*)buffer,
    count / 4,
    0,
    control,
    &the_status,
    count / 4
    );
    }

    if ( write_result == TRUE )
    {
    result = ERRORCODE_NO_ERROR;
    }

    return (result);
    }

  • Phil,

    Sorry for the late reply.

    The Fapi_HardwareCalculateEcc() function in the current library does not work for TMS470M series. I would like to recommend the following method to calculate ECC using TMS470 Flash wrapper. The following code sequence returns one byte ECC for a 64 bit data.

    #define FEMU_ECC_Reg *(unsigned char *)0xfff87063
    #define FEMU_ADDR_Reg *(unsigned int *)0xfff87068
    #define FEMU_DMSW_Reg *(unsigned int *)0xfff87058
    #define FEMU_DLSW_Reg *(unsigned int *)0xfff8705c

    unsigned char ECC;

        FEMU_ADDR_Reg = FlashAddr;   // write flash address to program. Must be 64 bit aligned
        FEMU_DLSW_Reg = FWM_Data[i<<1];  // write lower 32 bit data
        FEMU_DMSW_Reg = FWM_Data[(i<<1)+1]; //write upper 32 bit data
       ECC = FEMU_ECC_Reg; //read ECC

    Please let know if this solves your problem.

    Thanks and regards,

    Zhaohong