CHECK SUM OF R305 (FINGERPRINT) PROBLEM

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am working on finger-print lock system project. in order to interface r305(fingerprint sensor), I have to send and receive commands serially. but I do not know how to calculate checksum.on 10 pg of datasheet there is written that checksum is the arithmetic sum of package identifier, package length, and all package content. I searched a lot that how to calculate checksum but did not find anything. do anyone here know how to calculate it?

I have added r305 user manual. 

Attachment(s): 

Last Edited: Wed. Jul 4, 2018 - 02:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It says:

The arithmetic sum of package identifier, package length and all package contens. Overflowing bits are omitted. high byte is transferred first

So what ismn't clear about that? "arithmetic sum" just means "add all the bytes" then the overflow means that if the sum comes to more than 65535 then the upper bits are lost and the "high first" means that the 2 bytes have the upper one first (so what is known as "big endian"). As AVR is "little endian" then you will need to do something about accessing the two bytes of any sum you create in the "other order"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

None of which has anything to do with In-System Debuggers and Programmers

 

It isn't even clear that an AVR is involved ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hassan6432 wrote:
I do not know how to calculate checksum.

Simply putting "r305 checksum" into google gives:

 

http://www.rhydolabz.com/wiki/?p=15770

 

as the top hit.

 

At the end is a link to an SDK, and an Arduino Library ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
an Arduino Library
Within which it does this as the last act of sending a packet:

  uint16_t sum = ((wire_length)>>8) + ((wire_length)&0xFF) + packet.type;
  for (uint8_t i=0; i< packet.length; i++) {
    SERIAL_WRITE(packet.data[i]);
    sum += packet.data[i];
  }

SERIAL_WRITE_U16(sum);

So after adding the 2 bytes for length and the one for type that then just does repeated "sum +=" to add the bytes of packet data. The final SERIAL_WRITE_U16 does the high/low splitting as:

#define SERIAL_WRITE_U16(v) SERIAL_WRITE((uint8_t)(v>>8)); SERIAL_WRITE((uint8_t)(v & 0xFF));