How to calculate BMHD CRC on PC?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User17612
Level 4
Level 4
First like received
Hi,

before flashing a BMHD into AURIX, I want to be sure, that I use the correct CRC values inside BMHD. How do I calculate the CRC for a BMHD in AURIX on my PC?

Thank you.
Lucas


#8042000 12392
0 Likes
1 Solution
User18151
Level 3
Level 3
First like received First solution authored
Hi,

You can use any available CRC calculator, which is capable to work with CRC-32 algorithm. A good one is the online CRC calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

Just use following configuration for the CRC calculator:

Use CRC32
A polynomial of: 0x4C11DB7
Initial value: 0xFFFFFFFF
Final XOR Value: 0xFFFFFFFF (for non inverted CRC)
Final XOR Value: 0x00000000 (for inverted CRC)
Take care of the correct byte order for the CRC input data, e.g. 0xB3 0x59 0x00 0xFF 0xA0 0x00 0x00 0x00

Regards
Christine

View solution in original post

3 Replies
User18151
Level 3
Level 3
First like received First solution authored
Hi,

You can use any available CRC calculator, which is capable to work with CRC-32 algorithm. A good one is the online CRC calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

Just use following configuration for the CRC calculator:

Use CRC32
A polynomial of: 0x4C11DB7
Initial value: 0xFFFFFFFF
Final XOR Value: 0xFFFFFFFF (for non inverted CRC)
Final XOR Value: 0x00000000 (for inverted CRC)
Take care of the correct byte order for the CRC input data, e.g. 0xB3 0x59 0x00 0xFF 0xA0 0x00 0x00 0x00

Regards
Christine
User20517
Level 1
Level 1
I am trying to reproduce the CRC and cannot get the same value. Here is a sample in Mcal.c from infineon.
The spec says to run the CRC over the first 24 bytes (0x00 - 0x17)

const BMD_HDR Bmiheader =
{
0x80000024,
0x0360,
0xB359,
0xA0000000,
0xA000000F,
0x03CF36C8,
0xFC30C937,
0x550EEF9E,
0xAAF11061
};

If I run
800000240360B359A0000000A000000F03CF36C8FC30C937
thru a CRC-32, I get a different value = 0xAA8AA9AC.

Same with this example which also comes from infineon code:

const BMD_HDR Bmiheader =
{
0x80000020,
0x0370,
0xB359,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x49E9B5B4,
0xB6164A4B
};
Using the parameters you described, I should get 0xBFF97B16, not 0x49E9B5B4.

Roger
0 Likes
User20517
Level 1
Level 1
I fixed it. I had to reverse the two 16-bit fields:
80000024B3590360A0000000A000000F03CF36C8FC30C937
which generates 0x550EEF9E which is correct.
0 Likes