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: TMS570LC4357 - CRC module

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

Tool/software: Code Composer Studio

I use TMS570LC4357 chip and Safe Ti Library. I have some questions about using CRC module and Safe Ti Library.

1. I want to use crc module. But, HL_crc.c file is not generated. I want to know How i can generate HL_crc.c file.

2. CRC module  is act before Self-Diagnosis. I test CRC module run in 2 location.

   (1) before init about self-diagnosis (The Green line) - there is no problem

   (2) after init about self-diagnosis (The Red line) - Self diagnosis fail

 ->   I want to know the reason why self-test fail after CRC module run when self-diagnosis init is finisied.

- Using code -

    crcInit();
    SL_flash_test_in_boot();   /*crc module run code*/

    /* Enable IRQ offset via Vic controller */
    _coreEnableIrqVicOffset_();

    /* Initialize VIM table */
    vimInit();

    /* Configure system response to error conditions signaled to the ESM group1 */
    /* This function can be configured from the ESM tab of HALCoGen */
    esmInit();
/* USER CODE END */

    _mpuInit_();
 
/* USER CODE BEGIN (23) */
/* USER CODE END */

    _cacheEnable_();

/* USER CODE BEGIN (24) */
/* USER CODE END */


/* USER CODE BEGIN (25) */
    if (resetReason == RESET_ERROR){
        systemREG1->SYSECR |= ((uint32)0x03u<<14);
    }
/* USER CODE END */

        /* initialize global variable and constructors */
    __TI_auto_init();
/* USER CODE BEGIN (26) */
    /* Initialize EPC */
    epcInit();
    /* enable DMA ECC */
    sl_dmaREG->DMAPCR |= (uint32)0xAU;

    /* initialise DMA RAM */
    SL_Init_Memory(RAMTYPE_DMA_RAM);

    /* Initialise ADC */
    adcInit();
    debug_printf( "adc init\n\r");
    /* Initialise ADC SRAM */
    SL_Init_Memory(RAMTYPE_MIBADC1_RAM);
    SL_Init_Memory(RAMTYPE_MIBADC2_RAM);

    /* Initialise MIBSPI */
    mibspiInit();

    /* Initialise MIBSPI SRAM */
    SL_Init_Memory(RAMTYPE_MIBSPI1_RAM);

    /* Initialise SCI */
    sciInit();
    gioInit(); /* thchung add */
    dmmInit();
    gioSetBit(gioPORTB, 1U, 0);         /* To do: move to HL.gio.h */

    /* Initialise CAN */
    canInit();
    /* Initialise CAN SRAM */
    SL_Init_Memory(RAMTYPE_DCAN1_RAM);
    SL_Init_Memory(RAMTYPE_DCAN2_RAM);
    gioInit();
    rtpInit();

    SL_ESM_Init(ESM_ApplicationCallback);
       _enable_interrupt_();

       uint32 i;
       uint32 size=(uint32)&ulHighHandlerSize;
       for(i=0;i<size;i++)
       {
           ((char *)&ulHighHandlerStartAddr)[i] =((char *)&ulHighHandlerLoadStart)[i];
       }

    crcInit();
    SL_flash_test_in_boot();  /*crc module run code*/

    SafetyBootMachine(); /*Self- Diagnosis funciton - in Safe Ti Library*/

Regards,

MInwoo

  • SL_flash_test_in_boot is not a function that we provide in Safety Diagnostic library. The function name suggests that it is meant to be run at boot time. Can you confirm that the function calls the SL_CRC_Calculate that we provide in the safety diagnostic library.

    Can you please provide insight by stepping into the SL_flash_test_in_boot what is the nature of the failure. Is this this a signature check failure or CRC Calculate failure. Is there a failed sector ? Are flash address and CRC parameters initialization done correctly ? can you compare them with the successful run at init.

    There are good details and examples provided with the following application notes on CRC module in HErcules:

    Regards,

    Rahul

  • Hello Rahul,

    SL_flash_test_in_boot is that i make this function to check pre-determined CRC for checking binary integrity.

    The code is as follows, it just check-crc between pre-determined CRC and Calclated CRC by CRC Module.

    void SL_flash_test_in_boot(void)
    {
        crcConfig_t     sCrcParams;


        sCrcParams.crc_channel   = CRC_CH1;
        sCrcParams.mode          = CRC_FULL_CPU;
        sCrcParams.pcount        = 0u; /* All counters are disabled in Full CPU mode */
        sCrcParams.scount        = 0u; /* All counters are disabled in Full CPU mode */
        sCrcParams.wdg_preload   = 0u; /* All counters are disabled in Full CPU mode */
        sCrcParams.block_preload = 0u; /* All counters are disabled in Full CPU mode */

        crcSetConfig(crcREG, &sCrcParams);
        int i = 0ul;

        for (i = 0ul ; i < _my_crc_table.num_recs ; i++)
        {
            volatile uint64 u64Signature  = 0ull;

            crcModConfig_t  sCrcModConfig;

            sCrcModConfig.crc_channel  = CRC_CH1;
            sCrcModConfig.mode         = CRC_FULL_CPU;
            sCrcModConfig.data_length  = (_my_crc_table.recs[i].size + 7ul) / 8ul;
            sCrcModConfig.src_data_pat = (uint64*)_my_crc_table.recs[i].addr;

            /* Compute CRC with HW Module, Full CPU Mode */
            crcChannelReset(crcREG, CRC_CH1);
            crcSignGen(crcREG, &sCrcModConfig);
            u64Signature = crcGetPSASig(crcREG, CRC_CH1);

            /* Check CRC */
            if (u64Signature != _my_crc_table.recs[i].crc_value)
            {
                while(1); /* Fail */
            }
            else
            {
                /* Pass */
            }
        }

    }

    I wonder that CRC module effects to the Self Diagnosis test when this act in between the initialize and self test code.

    Regards,

    Minwoo