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.

RM41L232: Do we have CRC memory safety API for Flash & SRAM ?

Part Number: RM41L232

Hello,

I needed to add CRC memory safety feature in firmware.

Can any one suggest me where to find CRC related code example ?

From below Forum, I get to know that "SL_CRC_Calculate" API from TI Safety diagnostic library is not useful, is it so ?

 

  • Hello,

    1. This is the example for calculating the CRC using the CRC module:

    2. There is no problem to use the CRC API defined in safety diagnostic library: SL_CRC_Calculate(). 

  • How to do CRC checking for Volatile memory(RAM) ?

    And Is it possible to check periodic CRC on volatile memory as part of UL-60730 Class C memory safety feature ?  

  • Hello Jagir,

    The CRC module can be used to test the integrity of static contents in the SRAM by calculating a CRC for all static contents and comparing this value to a previously generated "golden" CRC. For other content in SRAM, it is very hard to use CRC since it changes dynamically.  

  • Hello,
    Can I use the below method for CRC Fault injection?
    the method is to create 63-bits CRC instead of 64-bit. Is this the correct method for memory CRC testing ?
    Also, Suggest another possible method for TI RM41L232 MCU for CRC flash memory fault injection.

    #ifdef CRC_FAULT_INJECTION
        data_length_crc = 7ul ;
    #else
        data_length_crc = 8ul ;
    #endif
    
    INT8U check_crc(void)
    {
    	uint32          i;
    	INT8U RetVal;
    	_pmuInit_();
    	_pmuEnableCountersGlobal_();
    
    	crcInit();
        crcConfig_t     sCrcParams;
    
        printf("Start CRC Calculation in Full CPU Mode\n");
    
        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);
    
        _pmuResetCycleCounter_();
        _pmuStartCounters_(pmuCYCLE_COUNTER);
    
        for (i = 0ul ; i < _my_crc_table.num_recs ; i++)
        {
            crcModConfig_t  sCrcModConfig;
            //volatile uint64 u64Signature  = 0ull;
    
            sCrcModConfig.crc_channel  = CRC_CH1;
            sCrcModConfig.mode         = CRC_FULL_CPU;
            sCrcModConfig.data_length  = (_my_crc_table.recs[i].size + 7ul) / data_length_crc;  // Fault Injection
            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)
            {
                printf("Wrong CRC in SW Module @ address: 0x%08X\n", _my_crc_table.recs[i].addr);
               /* Fail */
                RetVal = FALSE;
            }
            else
            {
                /* Pass */
                printf("Pass\n");
                RetVal = TRUE;
            }
        }
    
        cycles = _pmuGetCycleCount_();
        _pmuStopCounters_(pmuCYCLE_COUNTER);
        printf("Finished CRC calculation, CPU cycles: %d\n", cycles);
    
        return RetVal;
    }

  • To check if the CRC module works as expected, I prefer to compare the CRC value from CRC module with the CRC value calculated using SW (or linker cmd).

    What is your purpose of "inject CRC fault"?