Help with CRC checksums


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2006
    Posts
    70

    Default Help with CRC checksums

    OK. It's almost 3 am, and I am stuck. Anybody familiar with CRC error checking?

    I have data coming into a PIC-based RFID reader, and I am trying to work out a way to do error checking using the CRC checksum that comes with the RFID code. I suppose this is not really a PicBasic question (I can write a checksum procedure easily enough), but I will post the code on how to read in a check RFID numbers if I can get it done.

    Here is the raw input from the reader--the first four lines are the RFID number (64 bits), and the last line is a 16-bit checksum:

    10001110 11110110
    10100010 10110100
    00111010 01101111
    00000000 00000001
    11000011 01000100

    I got these data using a logic analyzer on the RFID board. I get the same data pattern over and over, and I have looked exhaustively for errors. So this has to be the correct output from the RFID tag.

    I thought that you could simply XOR down each column of bits to get the checksum, but that obviously is not correct. The specifications for the error checking procedure are published here http://www.cw-craft.com/DATA/ISO11785英文.pdf (see page 10). I am not an engineer, so this document is a bit of a mystery to me. At first it seems like the simple Binary Arithmetic (with No Carries) would work, but then there's that diagram on page 10 and the opcode on the next page (why do engineers shun normal language?).

    If this is all too much for you, then perhaps you could tell me what this sort of number notation is: (0 x 1 021)? This is the polynomial key for the checksum procedure, but I don't know what the actual number is. Kind of difficult to look up this sort of thing.

    I'll be dreaming in binary tonight for sure.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    This should do it for you.
    http://www.picbasic.co.uk/forum/show...8599#post78599

    Just zero the CRC variable first, then feed the subroutine 1 byte at a time.
    Your data is "8e f6 a2 b4 3a 6f 00 01" in hex, and the CRC result is $C344.

    I've tested it here, and it matches your CRC.

    FYI: It is a CRC (Cyclic Redundancy Check). A Checksum is something entirely different.
    DT

  3. #3
    Join Date
    Nov 2006
    Posts
    70


    Did you find this post helpful? Yes | No

    Default Thanks Darrel

    Thank you Darrel. I still cannot figure out the CRC process, but I had no trouble getting your subroutine to work. So I am just going to purloin what you have written and stop thinking about it for now. On to more pressing issues (like getting the PIC to read in the data--not as easy as I thought it would be).

    Cheers,
    E

  4. #4
    Join Date
    Feb 2012
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Help with CRC checksums

    Hello to everyone, I need some help with CRC... or checksum
    Here is just 1am, but I am stuck!

    I need to calculate maybe checksum from a data stream, I have some information for it, but I can not figure it out how to work with.

    From the documentation that I have, this is the information


    " The data at ascii is this $P;aa;bbbbb;cc;d;eeeeeeeee;crc
    a : 2 bytes
    b : 5 bytes
    c : 2 bytes
    d : 1 byte
    e : 9 bytes
    crc: Chksum 3 bytes (EXCLUSIF) "



    and some real examples here:
    $P;21;00987;10;3;000075991;191 (hex: 24 50 3B 32 31 3B 30 30 39 38 37 3B 31 30 3B 33 3B 30 30 30 30 37 35 39 39 31 3B 31 39 31)
    or
    $P;22;00000;00;0;002413651;189 (hex: 24 50 3B 32 32 3B 30 30 30 30 30 3B 30 30 3B 30 3B 30 30 32 34 31 33 36 35 31 3B 31 38 39)
    or
    $P;21;00000;00;0;000144924;182 (hex: 24 50 3B 32 31 3B 30 30 30 30 30 3B 30 30 3B 30 3B 30 30 30 31 34 34 39 32 34 3B 31 38 32)


    At the first example the crc is 191 (ascii), at the second is 189 and at the third is 182

    According the small documentation that I have, this checksum or crc (I know that is something entirely different) is calculate with Xor,
    but I cant find how.

    Can anyone help me about?

    Thank you for your time

    Nick

  5. #5
    Join Date
    Feb 2012
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Help with CRC checksums

    No one?
    I dont know if I hive the wright information about my problem, If someone
    need more info, maybe I can give something.
    Anyone?

    Thanks

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts