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.

CC1312R: Help with setting up a custom CRC polynomial for the radio.

Part Number: CC1312R
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Good afternoon. I have a new product with the CC1312R1 chip, but I need to make it backward compatible with some of our older products.
These older products use the Microchip MRF89XA transceiver chip and the NXP MKW01Z128 radio. Both of these radios seem to use the same CRC polynomial as they successfully communicate with each other.

However when I try to receive packets from either of the above products using the CC1312R, I get a CRC error. The packet data is correct, so I am fairly confident that the frequency, symbol rate, receiver Bandwidth etc are all correct.

Datasheets for both the MRF89XA and the MKW01 seems to suggest they are basing their CRC's on the CCITT polynomial and the CRC Polynomial =X16 + X 12 + X 5 + 1 (Datasheet available here https://ww1.microchip.com/downloads/aemDocuments/documents/WSG/ProductDocuments/DataSheets/MRF89XA-Data-Sheet-DS70000622.pdf Page 17 shows the CRC polynomial)

Any pointers on how to implement this in the CC1312 CRC would be greatly appreciated.

Best Regards

Gavin

  • Hi Gavin,

    I would recommend you to look in the Radio chapter of the Technical Reference Manual, specifically the radio mode you are using (e.g. Prop RF is section 25.10). 

    https://www.ti.com/lit/swcu185

    For each command the CRC options are described, eg. whether to include sync word in CRC calculation. The whitenMode option of the SETUP command decides the CRC polynomial. It sounds like the default polynomial should work with your peer device. This screen shot is from section 25.10.5.2 Proprietary Mode Setup Command.

    Cheers,

    Marie H

  • Thank you Marie, I'll take a look at those sections.

  • Thankyou Marie and TheGhostOf for your pointers.

    Through some testing and reverse engineering I have figured out that the CRC protocol for the old radio systems is the following.

    CRC polynomial = 1021
    Init Value 0x1D0F
    XOR Value 0xFFFF

    and that it calculates the CRC over the payload and the header, therefore it looks like CMD_PROP_RX should be suitable for my needs, rather than the CMD_PROP_RX_ADV 

    I have set the overrides up for the above 3 settings, but it is still failing on the CRC. Investigation shows the CRC XOR value is still set to 0, and not 0xFFFF as per the override. The other two overrides appear to be working. Any suggestions? My override list is here with the parts I added hilighted

    static uint32_t overrides[] =
    {
    // override_prop_common.json
    // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x7 (DITHER_EN=0 and IPEAK=7).
    (uint32_t) 0x00F788D3,
    // override_prop_common_sub1g.json
    // Set RF_FSCA.ANADIV.DIV_SEL_BIAS = 1. Bits [0:16, 24, 30] are don't care..
    (uint32_t) 0x4001405D,
    // Set RF_FSCA.ANADIV.DIV_SEL_BIAS = 1. Bits [0:16, 24, 30] are don't care..
    (uint32_t) 0x08141131,
    // override_tc106.json
    // Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4:3]=0x3)
    ADI_2HALFREG_OVERRIDE(0, 16, 0x8, 0x8, 17, 0x1, 0x1),
    // Rx: Set AGC reference level to 0x1A (default: 0x2E)
    HW_REG_OVERRIDE(0x609C, 0x001A),
    // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2), trimmed for external bias and differential configuration
    (uint32_t) 0x000188A3,
    // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD)
    ADI_HALFREG_OVERRIDE(0, 61, 0xF, 0xD),
    // Tx: Set wait time before turning off ramp to 0x1A (default: 0x1F)
    HW_REG_OVERRIDE(0x6028, 0x001A),
    // Configure new CRC-16 polynom
    HW32_ARRAY_OVERRIDE(0x2004, 1),
    // The CRC-16 polynome: CRC-16-CCITT normal form, 0x1021 is x^16 + x^12 + x^5 + 1
    0x10210000,
    /* Override crcInit to 0x1D0F */
    (uint32_t) 0xC0040051,
    (uint32_t) 0x1D0F0000, // Init value is stored in MSBs of a 32-bit value
    /* Set XOR value to 0xffff */
    (uint32_t) 0xC0040061,
    (uint32_t) 0xFFFF0000, // XOR value is stored in MSBs of a 32-bit value
    (uint32_t) 0xFFFFFFFF
    };

    I got these overrides from the link that TheGhostOf supplied.


    On a final note, is there a better way of using the overrides? I copied the overrides from the sysconfig generated file, ti_radio_config.c, then added the extra ones to the end of the list, then pointed to the new override struct using
    RF_cmdPropRadioDivSetup.pRegOverride = (uint32_t*) overrides;

    Fine for testing, but not great as any modifications to sysconfig in the future could cause issues.

    Best Regards

    Gavin

  • OK the final issue with the XOR value is now fixed following the answer from this thread "https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/963795/launchxl-cc1352r1-change-crc-xor-value?tisearch=e2e-sitesearch&keymatch=crc%25252525252525252520xor#"

    it looks like this datasheet "https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_41_00_17/docs/proprietary-rf/proprietary-rf-users-guide/proprietary-rf/packet-format.html#crc-calculation" is still incorrect with regards to the XOR value. It should be using the lower 2 bytes, not the higher two as per TER's answer in the linked thread.. 

  • Hi Gavin,

    Glad to hear you got it to work.

    Yes this is the recommended way to use overrides.

    I will make a ticket to correct the User's Guide that you linked. Thanks for making me aware.

    Cheers,

    Marie H