-
Notifications
You must be signed in to change notification settings - Fork 0
Firmware Overview
If you are interested, this section goes just a little further by looking at the Arduino blink example and how the command protocol functions based on the fingerprint scanner's manual.
Verifying the Checksum Value
To verify the check sum for the command packet (command) or response packet (acknowledge), you would add the bytes of the command start codes, device id, parameter, and command/response. Looking at the Arduino blink example, the serial monitor outputs:
FPS - Open
FPS - SEND: "55 AA 01 00 00 00 00 00 01 00 01 01"
FPS - RECV: "55 AA 01 00 00 00 00 00 30 00 30 01"
FPS - LED on
FPS - SEND: "55 AA 01 00 01 00 00 00 12 00 13 01"
FPS - RECV: "55 AA 01 00 00 00 00 00 30 00 30 01"
FPS - LED off
FPS - SEND: "55 AA 01 00 00 00 00 00 12 00 12 01"
FPS - RECV: "55 AA 01 00 00 00 00 00 30 00 30 01"
The example displays the packet structure as a multi-byte item represented as little endian. Breaking down the LED command to turn the LED OFF in hex, it is:
55 AA 01 00 00 00 00 00 12 00 12 01
, where Command Start code1 = 0x55
Command Start code2 = 0xAA
Device ID = 0x00 01
Input parameter = 0x00 00 00 00
Command Code = 0x00 12
By adding the hex values with a programmer's calculator as stated in the datasheet:
OFFSET[0] + OFFSET[1] + OFFSET[2] + OFFSET[3] + OFFSET[4] + OFFSET[5] + OFFSET[6] + OFFSET[7] + OFFSET[8] + OFFSET[9] = 0x55 +0xAA + 0x01 + 0x00 + 0x00 + 0x00 + 0x00 + 0x00 + 0x12 + 0x00
we are able to get the same output result as the command packet's check sum:
Checksum = x01 12
Since the check sum is read as little endian, the output reads the checksum as "12 01".