CRC calculation
kt88seamp
Posts: 112
So does a CRC work by this?
- The transmitter calculates a checksum by dividing the contents of the packet by a defined constant and places it in the packet.
- The transmitter transmits the packet.
- The reciever verifies the checksum by multiplying the contents of the packet by the same defined constant.
- If the two match, the packet is good.
I am new at this and I probably am missing something.
- The transmitter calculates a checksum by dividing the contents of the packet by a defined constant and places it in the packet.
- The transmitter transmits the packet.
- The reciever verifies the checksum by multiplying the contents of the packet by the same defined constant.
- If the two match, the packet is good.
I am new at this and I probably am missing something.
Comments
If you ask the mathematician, you'll get a detailed mathematical explanation phrased in terms of multiplications, divisions, remainders, polynomials, etc., but which may not be very helpful in implementing one in code or hardware.
But if you ask an engineer, you'll be shown how a serial stream of bits can be processed by doing a relatively simple one bit operation as each new bit arrives, resulting in a number that says the full packet is either good or no good.
Depending on your interest, one or the other may be more useful.
< preamble > < data > < checksum >
Lets say the packet contains this data:
< 10101010 > < 10010011 > < computed checksum >
http://forums.parallax.com/showthread.php?p=718391
Ray
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
kt88seamp> An actual crc check is more complicated, but yes, similar. Now I do wanna emphasize that you don't modify the data to be transmitted, this would just result in some sort of crappy encryption. Can't tell if that's what you where intending in the post or not.
Post Edited (James Newman) : 4/3/2010 12:21:20 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
http://forums.parallax.com/showthread.php?p=853681
I does not appear that if corrupt data is found, a retransmit will be requested due to latencies between switching modes. What does Bean mean by sending packets in burst? Does it mean send a bunch of packets, and verify them all in a batch instead of in real time?
Post Edited (kt88seamp) : 4/3/2010 4:38:09 AM GMT
I'm not sure where I see your reference to 'Bean' in that link
You are correct though, there is no bi-directional handshaking to negotiate a re-transmit if the received data does not match the locally generated CRC.
I could not find in the thread where you mention "sending packets in burst?" ... typically though CRC is performed on a large data block instead of just a few BYTEs, so sending data packet bursts are not that uncommon. That said, a CRC is performed individually on each data packet and because the CRC routine is written in Propeller Assembly it can keep up in reasonable real time. (<--tested at 9600 baud wireless.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
May the road rise to meet you; may the sun shine on your back.
May you create something useful, even if it's just a hack.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Depending on the application, a bit-by-bit implementation in spin may be good enough.
Dave
http://forums.parallax.com/showthread.php?p=853681
There are many ways to do some things. The way you choose depends on your goal.
Often programming requires a trade-off between size and speed.
The smallest non table driven Spin CRC method is slow but useful if you have lots of spare time.
The alternative table driven Spin CRC method is much faster if you have lots of spare memory.
The same non-table CRC algorithm to PASM is faster if you have a spare COG and extra HUB.
Beau's PASM CRC code which does this is here for reference:
http://forums.parallax.com/attachment.php?attachmentid=64921
A table driven Spin CRC method is reasonably fast and can be found here for reference:
http://forums.parallax.com/showthread.php?p=800272
A non table driven Spin CRC method is included at the end of Rayman's YModem.spin file here:
http://forums.parallax.com/showthread.php?p=718391
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
May the road rise to meet you; may the sun shine on your back.
May you create something useful, even if it's just a hack.
It looks like he is discarding the data packet if the CRC is bad.
You could use RF_Transceiver.spin CRC_Valid after calling Recieve to tell if the the last packet was bad.
I assume you mean the latest version like here:
http://forums.parallax.com/showthread.php?p=856983
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
May the road rise to meet you; may the sun shine on your back.
May you create something useful, even if it's just a hack.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.