nRF5340 shockburst software CRC calculation

Dear nordic team,

we are successfully communicating our old nRF2401 shockburst design to a nRF5340 board; except for the CRC.

The challenge: the nRF2401 shockburst allowed payload lengths which are not multiples of bytes. Our payload length is 95 bit. Therefore we cannot use the nRF5340 integrated algorithm, as this only works when the payload is a multiple of bytes.

Trying to calculate the CRC in software, we ran into a number of issues. We could find the following information in the nRF24L01 datasheet:

CRC-16-CCITT (polynomial 0x1021) with 0xFFFF initial value. The CRC is calculated on address, packet control field, and payload.

A load of questions we would love the answer to please:

  •  easiest one first: for shockburst compatibility, there is no packet control field. We set the length of S0, Length, and S1 to 0. The CRC therefore only includes address and payload - right?

  • address: the address used by our nRF2401 is 0x C5 5A AA. For the nRF5340, we had to deal with endianess, and it's different on air etc. - this work now. But: how does the address go to the CRC algorithm please - which byte first, and which bit first?

  • payload: similar to address: in which byte and bit order is this going into CRC?


Thank you!

Uli

Parents
  • Only the address and payload is calculated in this case yes. The order is the order the bits are sent on-air for both address and payload (the easiest may be to just connect a logic analyzer to the SPI pins of the nRF2401 to check the bit order, both the address and payload are clocked in for each transmission from the nRF2401). If you are using 95-bits for the payload, I assume this becomes difficult to calculate, at least with various crc calculators online due to the non-byte aligned bitstream.

    Best regards,
    Kenneth

Reply
  • Only the address and payload is calculated in this case yes. The order is the order the bits are sent on-air for both address and payload (the easiest may be to just connect a logic analyzer to the SPI pins of the nRF2401 to check the bit order, both the address and payload are clocked in for each transmission from the nRF2401). If you are using 95-bits for the payload, I assume this becomes difficult to calculate, at least with various crc calculators online due to the non-byte aligned bitstream.

    Best regards,
    Kenneth

Children
Related