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.

BIM CRC16 (OAD)

Other Parts Discussed in Thread: CC2541

Hi,

Which polynomial/algorithm is used to calculate the CRC16 field in the image header for OAD (as checked by the BIM)?

The BIM's source (function crcCalc inside bim_main.c) doesn't really indicate which polynomial or other parameters (reversed, XOR's, etc) are used.

Also, I've tried to calculate the CRC16 myself on a generated binary file, excluding the first 4 bytes (which are CRC and CRC_SHADOW), with several polynomials (CRC16, CCITT, XMODEM, CRC16-Reversed and others), but none of those turned out equal to the CRC which the IAR produces (first 2 bytes of the bin file).

Any help will be appreciated.

  • Supposedly, the CRC16 is simple, uses the 0x8005 polynomial and a starting value of zero which is shown over a simple test vector here:

    http://www.lammertbies.nl/comm/info/crc-calculation.html

    But IAR and the CC2541 calculate the same, but different result over the same test vector. I attached a simple IAR project that I used to demonstrate to IAR a bug in their handling of uint16 args in a function call (no response after months, so they don't care), so look at the output of calcCrc_Workaround() and look at the CRC that IAR calculates in the output .map file, both are 0xFEE8, not the "expected" 0xBB3D.

    crc16-8005.zip