Calculation of CRC in Frame Check Sequence (FCS) field of IEEE 802.15.4

Hello Devzone Community,

I try to redo the CRC check of an incoming IEEE 802.15.4 frame in software after manipulating certain positions.

Since the check of the Frame Check Sequences (FCS) is done in HW directly at the arrival of the frame, I extract the content of the RXCRC register.

However, I had to realize that I was not able to reproduce the FCS values from my sample frames.

Here is what I get as FCS for different sample payloads:

Payload FCS (decimal) FCS (hex)
0x01 37256 0x9188
0x02 18628 0x48C4
0x0123 33360 0x8250

I am using the default IEEE 802.15.4 configuration according to specification Section 6.20.12.5 (https://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.1.pdf), i.e.,

/* 16-bit CRC with ITU-T polynomial with 0 as start condition*/

write_reg(NRFRADIO_REG(CRCCNF), 0x202);

write_reg(NRFRADIO_REG(CRCPOLY), 0x11021);

write_reg(NRFRADIO_REG(CRCINIT), 0);

I have tried out many different CRC algorithms (https://reveng.sourceforge.io/crc-catalogue/16.htm) to reproduce the values from the table, but I did not succeed.

From my understanding, the ITU-T CRC16 algorithm should be used with seed set to 0x0000.

Interestingly, I found out that on the nRF the FCS computed for the sample payload 0x02 is half of the value as for 0x01.

For the tried out CRC algorithms, this was the opposite, i.e., for payload 0x02, the resulting FCS was double the FCS as for 0x01.

Can someboy please provide me a reference implementation of the CRC algorithm used on the nRF52840?

Thanks in advance!

Related