Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Calculating CRC

sairfan1

Full Member level 1
Joined
Jun 12, 2010
Messages
97
Helped
4
Reputation
8
Reaction score
7
Trophy points
1,288
Location
Regina, Canada
Activity points
2,371
I'm reading datasheet for nRF24L01 family module, please refer to link to open datasheet at page 28 (section 7.3.5 quited below) it tells calculating CRC that I could not understand.
For example sending text is 'Hello' how will I calculate CRC and what will be final CRC number I will get, (I believe its called checksum)
I'll appricate if someone also include how to varify CRC at receiving end.

7.3.5 CRC (Cyclic Redundancy Check)
The CRC is the mandatory error detection mechanism in the packet. It is either 1 or 2 bytes and is calculated over the address, Packet Control Field and Payload.
The polynomial for 1 byte CRC is X8 + X2 + X + 1. Initial value 0xFF.
The polynomial for 2 byte CRC is X16+ X12 + X5 + 1. Initial value 0xFFFF.
No packet is accepted by Enhanced ShockBurst™ if the CRC fails

Datasheet link at sparkfun nRF24L01

To make it easy I'm mentioning hex for string 'Hello' if someone calculation CRC for below I believe it will greatly help me to understand its calculation.

H = 0x48
e = 0x65
l = 0x6C
l = 0x6C
o = 0x6F

I found a couple of videos on youtube.com but could not understand



 
Hi,

what did you do so far?
Where is your code?
How did you test it?
What is your expectation?
What do you see instead?

There are discussions on NORDIC forum, there is a wikipeda section about CRC calculations, there are tons of correctly working solutions in the internet.
There even are online CRC calculators...

And there is the option to deactivate CRC validation.

***
hex for string 'Hello' :

H = 0x48
e = 0x65
l = 0x6C
l = 0x6C
o = 0x6F
delmiter 0x00

do you want the delimiter to be sent? Does your routine send/not send the delimiter?

Klaus
 
I'm sorry if my question was not clear enough, my question is how to calculate CRC
As I'm trying to learn calculating CRC, first I reach at a point when I can give it a try calculating CRC then code and effort will involve
Thanks for sharing some information that I can explore wikipedia and Nordic forum, I will explore it,

I have seen some websites having calculators for CRC calculations but again my question is how to, I'm not looking for calculated answer. before asking question I also searched on edaboard and there are couple of questions I found but i was not able to understand how can i calculate each letter for Hello, I learned there are lots of formulas for calculating CRC, every new search brings up something different and that leads to more confusion to understand, as a layman I was looking for help to understand formula given in the datasheet

X8+ X2+ X + 1

does it mean 'Hel' should be 0x6C8 + 0x652 + 0x48 + 1
Answer will be a large number but datasheet says CRC could be one OR two bytes, I'm sorry I'm totally dumb could not get it.
 
Hi,

an internet search on "crc calculation algorithm" brought this as first hit.
Everything is explained in detail .. also the polinomial expression ... even with code examples.

Go through it, then ask a more detailed question... telling what you understand so far and what is unclear.
Read documents and refer to them.

Klaus
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top