Hi,
I have two nRF52840-DK with one transmitting and one receiving. I have been trying to calculate the CRC for an ESB packet. However, the CRC reported by the Rx board (using nrf_radio_rxcrc_get(NRF_RADIO)) differs with my calculations.
The ESB is configured using ESB_LEGACY_CONFIG with Dynamic Payload and 2-byte CRC. The code is based on the examples from the SDK /esb/esb_prx and /esb/esb_ptx
The packet is structured as follows (in order):
- Address (0xE7E7E7, 3 bytes)
- Prefix (0xE7, 1 byte)
- Packet control field consisting of
- Payload length (0x20, 6 bits)
- PID (For simplicity, I only consider the case where PID=0x00, 2 bits)
- NO_ACK (0x00, 1 bit)
- Payload (32 bytes of 0x00)
For the above packet, the CRC reported by the receiving board is 0xFA78.
I calculated the CRC using an Excel implementation. It is not the most efficient but helps visualise and check the CRC calculation method. I have also validated the spreadsheet using this as guidance: https://srecord.sourceforge.net/crc16-ccitt.html. The calculated CRC for the above packet is 0xF2E2.
I've clearly done something wrong. Perhaps it is my understanding of the ESB packet structure/content or CRC calculation.
Any guidance would be appreciated.
Thanks