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.

MSPM0G3519: Trying to run CRCP against a standard IEEE 802.3 polynomial

Part Number: MSPM0G3519
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Team,

 Our customer is trying to run CRCP against a standard IEEE 802.3 '0x04C11DB7' polynomial and test string {'1','2','3','4','5','6','7','8'}. That should generate 0xE3C97CBC CRC. But can’t really get it to work.

 Ideally, one should be able to read and load this as 32b data with setting LE or as 8 bit regardless in but none of it gets correct result so far.

 

  1. Does CRCP stream 32b data byte-by-byte through the CRC engine or the whole 32b value is used?
  2. Any hints or suggestion on how to configure CRCP to get this right or maybe some pseudo code explaining how CRCP CRC engine works?

 There is nothing at the moment within the device TRM about CRC internals. Eventually they would want DMA to do the loads.

Any input welcomed!
 

Regards,

CY

  • Hi CY,

    It is a hardware accelerator.

    • Does CRCP stream 32b data byte-by-byte through the CRC engine or the whole 32b value is used?
    • Any hints or suggestion on how to configure CRCP to get this right or maybe some pseudo code explaining how CRCP CRC engine works?

    It doesn't matter how it really works in low level, we can treat it as an input-output model.

    For the how to implement in software code, you can refer to the SDK demo project, which also includes the DMA methods for this.

    https://dev.ti.com/tirex/explore/node?node=A__ALAN0bj6VmKQrgGhjKb.Eg__MSPM0-SDK__a3PaaoK__LATEST 

    It is a CRC16 demo, while it is simple to migrated to CRC32.

    Several configurations need be taken care of:

    1.CRC-32 setting:

    2. SEEK value (initialization value)

    I am not sure what's IEEE 802.3 is, while I tested it with JAMCRC, with the input of string {'1','2','3','4','5','6','7','8'}

    And the output is "0x651F2550", which is the correct result of the CRC input string.

    B.R.

    Sal

  • CY, thank you for good question.

    @Sal. I am not sure that applying input-output model without comprehensive examples clarifies the behavior. 

    Let's look at some of them from https://www.autosar.org/fileadmin/standards/R23-11/CP/AUTOSAR_CP_SWS_CRCLibrary.pdf.

    The "check CRC" in the tables below is for ASCII values ’1’ ’2’ ’3’ ’4’ ’5’ ’6’ ’7’ ’8’ ’9’ corresponding to values 31h 32h 33h 34h
    35h 36h 37h 38h 39h is fed through the specified algorithm byte-by-byte.

    As I understand CRCP does not apply XOR to CRC so that should be done after. Btw, in your example "0x651F2550 ^ 0xFFFFFFFF = 0x9AE0DAAF which is not what is in the above example (please see https://www.sunshine2k.de/coding/javascript/crc/crc_js.html as well).

    1. Would it be possible to provide example of setting up CRCP using DL_CRCP driver APIs (not SysConfig) here to get the results from the above tables?
    2. Would result change when data is fed into CRCP using 32 bit quantities (LE): 0x31323334 and 0x3536373839?
    3. What would change if the 32 bit quantities are in BE 0x34333231 and 0x3938373635?

    Regards,

    Eugene

  • Hi Eugene,

    The "check CRC" in the tables below is for ASCII values ’1’ ’2’ ’3’ ’4’ ’5’ ’6’ ’7’ ’8’ ’9’ corresponding to values 31h 32h 33h 34h
    35h 36h 37h 38h 39h is fed through the specified algorithm byte-by-byte.

    I tested the input of ‘1-8’, due to CL asked this in the thread:

     Our customer is trying to run CRCP against a standard IEEE 802.3 '0x04C11DB7' polynomial and test string {'1','2','3','4','5','6','7','8'}. That should generate 0xE3C97CBC CRC. But can’t really get it to work.

    I believe this is correct value:

    So, one conclusion from your side is correct, the final XOR operation is not executed in the hardware side.

    I just used the example project, and modify it to CRC-32, the sysconfig file:

    /*
     * Copyright (c) 2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    #include "ti_msp_dl_config.h"
    
    #define CRCP_NUM_OF_WORDS (8)
    #define CRCP_EXPECTED_RESULT (0x651F2550)
    uint8_t gData8[CRCP_NUM_OF_WORDS] = {'1', '2', '3', '4', '5', '6', '7', '8'};
    
    const uint32_t gCrcpSeed            = CRCP_SEED;
    volatile bool gCheckCRCP;
    
    int main(void)
    {
        volatile uint32_t crcpChecksum;
        __attribute__((unused)) volatile bool crcpChecksumMatch;
    
        SYSCFG_DL_init();
    
        /* Configure DMA source, destination and size */
        DL_DMA_setSrcAddr(DMA, DMA_CH0_CHAN_ID, (uint32_t) &gData8[0]);
        DL_DMA_setDestAddr(DMA, DMA_CH0_CHAN_ID, DL_CRCP_getCRCINAddr(CRCP0));
        DL_DMA_setTransferSize(
            DMA, DMA_CH0_CHAN_ID, sizeof(gData8) / sizeof(uint8_t));
        DL_DMA_enableChannel(DMA, DMA_CH0_CHAN_ID);
    
        /*
         * Confirm DMA channel is enabled before issuing a SW trigger of the DMA
         * channel
         */
        while (false == DL_DMA_isChannelEnabled(DMA, DMA_CH0_CHAN_ID)) {
            __BKPT(0);
        }
    
        /* Configure device exception handling */
        DL_SYSCTL_disableSleepOnExit();
        NVIC_EnableIRQ(DMA_INT_IRQn);
        gCheckCRCP = false;
    
        /* Trigger DMA via SW request */
        DL_DMA_startTransfer(DMA, DMA_CH0_CHAN_ID);
    
        /* Wait in SLEEP mode until DMA interrupt is triggered */
        while (false == gCheckCRCP) {
            __WFE();
        }
    
        /* Check CRCP checksum */
        crcpChecksum = DL_CRCP_getResult32(CRCP0);
    
        if (CRCP_EXPECTED_RESULT == crcpChecksum) {
            crcpChecksumMatch = true;
            DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
        } else {
            crcpChecksumMatch = false;
        }
    
        __BKPT(0);
    
        while (1) {
            __WFI();
        }
    }
    
    void DMA_IRQHandler(void)
    {
        switch (DL_DMA_getPendingInterrupt(DMA)) {
            case DL_DMA_EVENT_IIDX_DMACH0:
                gCheckCRCP = true;
                break;
            default:
                break;
        }
    }
    

    Then, you can modify it without sysconfig, all the code the example project is attached.

    • Would result change when data is fed into CRCP using 32 bit quantities (LE): 0x31323334 and 0x3536373839?
    • What would change if the 32 bit quantities are in BE 0x34333231 and 0x3938373635?

    You can take a try based on the project. I think the #2 will output the same result, and #3 will not.

    B.R.

    Sal

  • All,

    This one can be closed. Customer resolved offline.

    TY,

    CY

  • Hi CY,

    Thanks for the update.

    I will close this thread.

    B.R.

    Sal