Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Computationally inexpensive 7-bit CRC/checksum applied on byte stream?

Computationally inexpensive 7-bit CRC/checksum applied on byte stream?

Scheduled Pinned Locked Moved Design and Architecture
hardwarequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arnold_w
    wrote on last edited by
    #1

    I'm working on an embedded communication protocol where bytes will be transmitted. In my packets, I can only allocate 7 bits for integrity check. If I just sum up the bytes module 256 and then throw out the MSb, then I suspect errors in the first bit in each byte would not be detected. Can someone please recommend a computationally inexpensive method that is a little more robust? It needs to be computationally inexpensive because it could potentially run on small, slow microcontrollers.

    N 1 Reply Last reply
    0
    • A arnold_w

      I'm working on an embedded communication protocol where bytes will be transmitted. In my packets, I can only allocate 7 bits for integrity check. If I just sum up the bytes module 256 and then throw out the MSb, then I suspect errors in the first bit in each byte would not be detected. Can someone please recommend a computationally inexpensive method that is a little more robust? It needs to be computationally inexpensive because it could potentially run on small, slow microcontrollers.

      N Offline
      N Offline
      Nathan Minier
      wrote on last edited by
      #2

      You could XOR the nibbles of each byte together and use aggregate those values as your checksum. It's not perfect, multiple errors in a byte could lead to collisions, but it's better than the alternative and should still be speedy.

      "Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups