RFID B1 Module User Manual
V2.3
21/05/2018
Table of Contents
1
2
Introduction ............................................................................................................................................................... 6
1.1
Device Overview .............................................................................................................................................. 6
1.2
Pinout .............................................................................................................................................................. 7
1.3
Application ....................................................................................................................................................... 8
1.4
Typical application schematic .......................................................................................................................... 8
Electrical Characteristics ............................................................................................................................................ 9
2.1
Test Conditions ................................................................................................................................................ 9
2.2
Absolute Maximum Ratings ............................................................................................................................. 9
2.3
Operating Conditions....................................................................................................................................... 9
2.4
Current Consumption .................................................................................................................................... 10
2.5
GPIO ............................................................................................................................................................... 10
2.6
Antenna Output ............................................................................................................................................. 11
2.7
Flash ............................................................................................................................................................... 11
2.8
IDAC ............................................................................................................................................................... 11
Parameters........................................................................................................................................ 11
Example Measurement (Error and Offset) ....................................................................................... 14
2.9
PWM .............................................................................................................................................................. 19
2.10 ADC ................................................................................................................................................................ 19
2.11 Comparator.................................................................................................................................................... 19
3
System...................................................................................................................................................................... 20
3.1
Overview ........................................................................................................................................................ 20
3.2
Modules ......................................................................................................................................................... 22
Core................................................................................................................................................... 22
RFID ................................................................................................................................................... 22
Power Manager ................................................................................................................................ 22
1
UART ................................................................................................................................................. 22
Temperature Sensor ......................................................................................................................... 23
ADC + MUX........................................................................................................................................ 23
Vdd Divider ....................................................................................................................................... 23
IDAC .................................................................................................................................................. 23
Comparator ....................................................................................................................................... 23
Voltage Reference ............................................................................................................................ 23
PWM Generator................................................................................................................................ 24
IO System .......................................................................................................................................... 24
TPI – Tag Presence Indicator ............................................................................................................. 24
3.3
Memory Map ................................................................................................................................................. 24
Result Register .................................................................................................................................. 26
Command Register ........................................................................................................................... 27
Command Parameters Register ........................................................................................................ 27
Tag UID Register................................................................................................................................ 27
Tag Type Register .............................................................................................................................. 28
Tag UID Size Register ........................................................................................................................ 28
Data Buffer ........................................................................................................................................ 28
Password Register............................................................................................................................. 29
AES Initialization Vector Register...................................................................................................... 29
AES Key Register ............................................................................................................................... 30
Authentication Key / Password Register .......................................................................................... 30
User Memory .................................................................................................................................... 31
4
Communication Interface ........................................................................................................................................ 32
4.1
Overview ........................................................................................................................................................ 32
4.2
Interface Signals ............................................................................................................................................ 32
4.3
Communication Protocol ............................................................................................................................... 33
4.4
CRC Calculation .............................................................................................................................................. 35
4.5
Command / Response Packet Construction .................................................................................................. 37
Header Construction ......................................................................................................................... 37
Data Construction ............................................................................................................................. 38
4.6
Timeout.......................................................................................................................................................... 39
2
5
Functional Description ............................................................................................................................................. 40
5.1
Overview ........................................................................................................................................................ 40
5.2
Flash Usage .................................................................................................................................................... 40
5.3
UART Commands ........................................................................................................................................... 41
Dummy Command (0x00) ................................................................................................................. 41
Write to RFID Memory (0x01)........................................................................................................... 41
Read from RFID Memory (0x02) ....................................................................................................... 42
Enter Sleep Mode (0x03) .................................................................................................................. 42
Reset (0x04) ...................................................................................................................................... 42
Set Baud Rate (0x05)......................................................................................................................... 43
Set Data Type (0x06) ......................................................................................................................... 44
Set Header Type (0x07)..................................................................................................................... 45
Set IO State (0x08) ............................................................................................................................ 46
Read IO State (0x09) ......................................................................................................................... 47
Set IO Interrupt (0x0A)...................................................................................................................... 48
Measure Voltage (0x0B) ................................................................................................................... 49
Measure Die Temperature (0x0C) .................................................................................................... 50
Set IDAC Current (0x0D) ................................................................................................................... 51
Enable Comparator (0x0E) ................................................................................................................ 52
Disable Comparator (0x0F) ............................................................................................................... 52
Enable PWM (0x10) .......................................................................................................................... 53
Set AES Init Vector (0x11) ................................................................................................................. 54
Set AES Key (0x12) ............................................................................................................................ 55
Read AES Init Vector (0x13) .............................................................................................................. 55
Read AES Key (0x14) ......................................................................................................................... 55
5.4
RFID Commands ............................................................................................................................................ 56
Get UID and Type (0x01) ................................................................................................................... 58
Read Block (0x02) ............................................................................................................................. 59
Write Block (0x03) ............................................................................................................................ 60
Read Data Block (0x04) ..................................................................................................................... 61
Write Data Block (0x05) .................................................................................................................... 62
Read Page (0x06) .............................................................................................................................. 63
3
Write Page (0x07) ............................................................................................................................. 64
Encrypt Data (0x08) .......................................................................................................................... 65
Decrypt Data (0x09) .......................................................................................................................... 66
Read Value (0x0A)............................................................................................................................. 68
Write Value (0x0B) ............................................................................................................................ 69
Increment Value (0x0C) .................................................................................................................... 70
Decrement Value (0x0D)................................................................................................................... 71
Restore Value (0x0E) ......................................................................................................................... 72
Transfer Value (0x0F) ........................................................................................................................ 73
Recover Value (0x10) ........................................................................................................................ 74
Get Version (0x11) ............................................................................................................................ 75
Read Signature (0x12) ....................................................................................................................... 76
Configure UID (0x13) ........................................................................................................................ 76
Read Counter (0x14) ......................................................................................................................... 77
Increment Counter (0x15) ................................................................................................................ 78
Check Tearing Event (0x16) .............................................................................................................. 79
Password Authentication (0x17)....................................................................................................... 80
Halt (0x18)......................................................................................................................................... 80
Calculate CRC (0x19) ......................................................................................................................... 81
Copy Data (0x1A) .............................................................................................................................. 83
Unlock (0x1B) .................................................................................................................................... 83
Lock (0x1C) ........................................................................................................................................ 84
Get Module Version (0x1D) .............................................................................................................. 84
Reset to Default (0x1E) ..................................................................................................................... 84
Enumerate Tags UID (0x1F) .............................................................................................................. 84
Enumerate Tags UID and Type (0x20) .............................................................................................. 84
Select Tag (0x21) ............................................................................................................................... 85
Polling (0x22) .................................................................................................................................... 86
5.5
Polling Mode .................................................................................................................................................. 89
Polling internal procedure ................................................................................................................ 89
Polling auto start............................................................................................................................... 90
Polling use simple example – Undefined Tags.................................................................................. 90
4
Polling use simple example – Defined Tags ...................................................................................... 91
Polling use simple example – Undefined and Defined Tags ............................................................. 92
Defined Tag List................................................................................................................................. 92
Polling stop and communication with tag example. ........................................................................ 93
5.6
Asynchronous Packets ................................................................................................................................... 94
5.7
Sleep Mode .................................................................................................................................................... 94
5.8
Power Down Mode ........................................................................................................................................ 94
5.9
Memory Locking ............................................................................................................................................ 95
5.10 nSLEEP Pin...................................................................................................................................................... 95
5.11 Reset to Defaults ........................................................................................................................................... 95
6
7
Mechanical ............................................................................................................................................................... 97
6.1
Dimensions .................................................................................................................................................... 97
6.2
Recommended Footprint .............................................................................................................................. 98
Errata ....................................................................................................................................................................... 99
7.1
IDAC ............................................................................................................................................................... 99
7.2
UART Packet Sizes.......................................................................................................................................... 99
5
1 Introduction
1.1 Device Overview
Features
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Low cost RFID Reader with MIFARE
Classic®, MIFARE Ultralight® and
NTAG2® support
Polling functionality (Stand alone
mode)
Command interface via UART with
optional AES-128 encryption
Multiple Tag support
UART baud rate up to 921600 bps
Compact form factor
Castellated SMT pads for easy and
reliable PCB mounting
High transponder read and write
speed
Low power design
Single operating voltage: 2.5V to 3.6V
-25°C to 85°C operating range
4 configurable GPIOs with interrupts
3 configurable PWMs
Comparator
ADC
Current Output DAC
AES-128 encryption engine
Multiple internal reference voltages
RoHS compliant
Applications
•
•
•
•
•
•
Access control
Monitoring goods
Approval and monitoring
consumables
Pre-payment systems
Managing resources
Connection-less data storage
systems
Description
The RFID B1 module is the second in an evolving family of
13.56MHz sub assemblies from Eccel Technology Ltd (IB
Technology). The product is designed with both embedded
applications and computing / PLC platforms in mind. This product
is an ideal design choice if the user wishes to add RFID capability
to their design quickly and without requiring extensive RFID and
embedded software expertise and time. An on board low power
ARM microcontroller handles the RFID configuration setup and
provides the user with a powerful yet simple command interface
to facilitate fast and easy read/write access to the memory and
features of the various transponders supported by this module.
A polling option with configurable IOs, PWM and Packet behavior
that is dependent upon the UID of the tag detected, makes it
simple to build a stand-alone device that can control door locks,
etc. and additionally send the detected tag UIDs to a host that is
connected to the module serial port (UART).
The module simply requires a single power and GND connection
from the user PCB, along with two connections to an antenna.
Eccel Technology Ltd (IB Technology) provide a range of suitable
antennas designed for use with this module.
6
1.2 Pinout
Pin
Number
1
Symbol
Type
GND
Ground
2
nRESET
Digital input with
pull-up
3
nSLEEP
Digital push-pull
output
4
nPWRDN
Digital input with no
pull resistors
5
IO3
6
IO2
7
IO1
8
IO0
9
UART TX
10
Description
Reset input signal (active low). This pin requires no external pull-up / down
resistor unless the module is used in noisy environments, in which case
connection of an external pull-up resistor combined with HF filter is
recommended.
Output signal indicating the device is in Sleep Mode or Power Down Mode
(active low).
Power Down Request input signal (active low). This pin has no pull-up/down
resistor and should NOT be left floating. For power optimization it is
recommended that the user drives this pin with a push-pull GPIO or similar.
General purpose
digital input-output
General purpose
digital input-output
General purpose
digital input-output
General purpose
digital input-output
Digital push-pull
output
General purpose digital input-output pin 1 / PWM Output 1 / Comparator
Output.
UART RX
Digital input with no
pull resistors
UART receiver signal line. This pin has no pull-up/down resistor. It should not be
left floating and it is recommended that the user connect this pin to the UART TX
pin of their host controller (GND-Vdd voltage range only).
11
12
13
14
15
16
GND
GND
ADC IN
CMP IN
IDAC OUT
NOT USED
Ground
Ground
Analog input
Analog input
Analog output
-
17
TPI
Digital push-pull
output
18
VDD
Power supply pin
19
20
21
22
GND
ANT2
ANT1
GND
Ground
Analog output
Analog output
Ground
General purpose digital input-output pin 3.
General purpose digital input-output pin 2 / PWM Output 2.
General purpose digital input-output pin 0 / PWM Output 0.
UART transmitter signal line.
Analog to Digital Converter input.
Comparator positive input.
Digital to Analog Converter with current-type output.
Leave floating.
Tag Presence Indicator is set to low state if Tag presence is detected. The state is
updated with every requested RFID command that enforces communication with
the Tag
Power Supply pin. Low ESR capacitor with capacitance 10uF or higher should be
connected close to this pin.
Antenna output.
Antenna output.
Table 1.2
7
1.3 Application
The RFID B1 module is specifically designed for embedded applications, where low pin count connection to a host
microcontroller together with ease of implementation are the most important factors. The UART interface provides a
command protocol which is flexible and easy to use. For the module, itself to be a fully functional RFID reader/writer
it only requires connection to a power supply and an antenna. Eccel Technology Ltd manufactures a wide range of such
antennas designed to give optimal performance with this module. Please contact us for further details of our range of
antennas.
1.4 Typical application schematic
Figure 1.4-1
8
2 Electrical Characteristics
2.1 Test Conditions
Typical device parameters have been measured at ambient temperature 22°C ±3°C and using a power supply of 3.3V
±5%.
2.2 Absolute Maximum Ratings
Symbol
Parameter
Min
Max
Unit
Notes
TS
Storage Temperature
-40
150
°C
Tested for 10'000 hours at 150°C.
VDDMAX
Supply Voltage
0
3.8
V
VIOMAX
Input Pin Voltage
-0.3
VDD + 0.3
V
IIOMAX
Output Pin Current
0
6
mA
IANT
ANT1 and ANT2 Current
0
100
mA
Maximum continuous current. This depends upon the impedance of the
circuit between ANT1 and ANT2 at 13.56MHz.
Table 2.2
2.3 Operating Conditions
Symbol
Parameter
Min
Max
Unit
TO
Ambient Temperature
-25
85
°C
VDD
Supply Voltage
2.5
3.6
V
Table 2.3
9
2.4 Current Consumption
Symbol
Parameter
IIDDLE
Iddle State Current
ISLEEP
Sleep Mode Current
IPWRDN
Power Down Current
ITX
IMAX
IPWMCH
ICMP
RFID Power Up
Current
Module Maximum
Current
Single Channel PWM
Current
Comparator Current
Typ
Max
Unit
Comment
1.78
1.8
1.85
0.9
1.8
40
400
mA
mA
µA
µA
nA
nA
24
mA
T = 25°C, Vdd = 3.3V. ADC, DAC, ACMP and PWM turned off.
Full range of temperature and power supply voltage.
T = 25°C, Vdd = 3.3V.
Full range of temperature and power supply voltage.
T = 25°C, Vdd = 3.3V.
Full range of temperature and power supply voltage.
T = 25°C, Vdd = 3.3V, 50Ω antenna connected between ANT1 and
ANT2.
120
mA
Maximum current consumed by the module in the worst conditions.
180
200
uA
T = 25°C, Vdd = 3.3V. No load on output. Frequency 200kHz.
46
150
50
400
uA
nA
T = 25°C, Vdd = 3.3V. No load on output. Iddle State.
No load on output. Sleep Mode State.
0.6
20
14
Table 2.4
2.5 GPIO
Symbol
Parameter
VIOIL
Input Low Voltage
VIOIH
Input High Voltage
IIOMAX
Output Pin Current
IIOLEAK
Input Leakage Current
Internal ESD Series
Resistor
IO Pin Histeresis
RIOESD
V IOHYST
Min
Typ
Max
Unit
0.3VDD
V
±6
mA
± 40
nA
0.7VDD
V
± 0.1
200
0.1V DD
Notes
Ω
V
Table 2.5
10
High impedance IO connected to VDD or GND.
2.6 Antenna Output
Symbol
fANT
fANTAG
VANTH
VANTL
IANT
Parameter
Min
Antenna Signal
Frequency
Antenna Signal
Frequency Aging
Antenna High Level
Output Voltage
Antenna Low Level
Output Voltage
ANT1 and ANT2 Current
Typ
Max
Unit
Notes
MHz
±30 ppm (-20°C - 70°C).
ppm
At 25°C.
V
VDD = 2.5V, IANT = 80mA.
0.64
V
VDD = 2.5V, IANT = 80mA.
100
mA
Maximum continuous current. This depends upon the impedance of
the circuit between ANT1 and ANT2 at 13.56MHz.
13.56
0
3
VDD - 0.64
0
60
Table 2.6
2.7 Flash
Symbol
Parameter
Min
CFE
Flash Erase Cycles Before
Failure
Typ
Max
Unit
20000
cycles
TFDR
Flash Data Retention Time
10
20
years
years
Notes
For ambient temperature < 85°C
For ambient temperature < 70°C
Table 2.7
2.8 IDAC
Parameters
IDAC Parameters
Source
Current drop at Temperature
Nominal
Range No Range [µA] Step Size [nA]
Vdd - 100 mV
coefficient
Current [µA]
[%]
[nA/°C]
Precision
0
1
2
3
< 0 ; 1.6 >
( 1.6 ; 4.7 >
( 4.7 ; 16 >
( 16 ; 64 >
50
100
500
2000
0.85
3.2
8.5
34
0.79
0.75
1.22
3.54
0.3
0.7
2.8
10.9
Table 2.8.1
11
Voltage
coefficient
[nA/V]
11.7
38.4
96.6
159.5
Sink
Temperature Voltage
Current drop at
coefficient coefficient
200 mV [%]
[nA/°C]
[nA/V]
0.3
0.32
0.62
1.75
0.2
0.7
2.8
10.9
12.5
40.9
94.4
148.6
Figure 2.8.1.1 Source Current
12
Figure 2.8.1.2 Sink Current
13
Example Measurement (Error and Offset)
Range 0 - Error [%] vs Curent [nA]
4,5
4
3,5
3
2,5
2
1,5
1
0,5
0
0
200
400
600
800
1000
1200
1400
1600
1800
Figure 2.8.1.3 50kΩ Sourcing
Range 1 - Error [%] vs Curent [uA]
3,5
3
2,5
2
1,5
1
0,5
0
0
1
2
3
Figure 2.8.1.4 50kΩ Sourcing
14
4
5
Range 2 - Error [%] vs Curent [uA]
0
0
2
4
6
8
10
12
14
16
18
-0,5
-1
-1,5
-2
-2,5
-3
Figure 2.8.1.5 50kΩ Sourcing
Range 3 - Error [%] vs Curent [uA]
-11,5
0
10
20
30
40
-11,6
-11,7
-11,8
-11,9
-12
-12,1
-12,2
-12,3
Figure 2.8.1.6 50kΩ Sourcing
15
50
60
70
Range 0 - Error [%] vs Curent [nA]
4,5
4
3,5
3
2,5
2
1,5
1
0,5
0
0
200
400
600
800
1000
1200
1400
1600
1800
Figure 2.8.1.7 50kΩ Sinking
Range 1 - Error [%] vs Curent [uA]
5
4,5
4
3,5
3
2,5
2
1,5
1
0,5
0
0
1
2
3
Figure 2.8-1.1.8 50kΩ Sinking
16
4
5
Range 2 - Error [%] vs Curent [uA]
0
0
2
4
6
8
10
12
14
16
18
-0,2
-0,4
-0,6
-0,8
-1
-1,2
-1,4
-1,6
Figure 2.8.1.2.8-2 50kΩ Sinking
Range 3 - Error [%] vs Curent [uA]
-10,6
0
10
20
30
40
-10,7
-10,8
-10,9
-11
-11,1
-11,2
-11,3
-11,4
Figure 2.8.1.2.8-3 50kΩ Sinking
17
50
60
70
Range 0 - Error [%] vs Curent [nA]
3
2,5
2
1,5
1
0,5
0
0
50
100
150
200
250
300
350
300
350
Figure 2.8.1.2.8-4 10MΩ Sourcing
Range 0 - Error [%] vs Curent [nA]
4,5
4
3,5
3
2,5
2
1,5
1
0,5
0
0
50
100
150
200
Figure 2.8.1.2.8-5 10MΩ Sinking
18
250
2.9 PWM
PWM Parameters
Period
Frequency
Minimum Maximum Minimum Maximum Maximum Error
[µs]
[s]
[Hz]
[kHz]
[%]
4.81
3.19
0.313
207.9
3
Table 2.9
2.10 ADC
Symbol
Parameter
Min
VADCIN
Input Voltage Range
0
IADCIN
Input Current
CADCIN
Input Capacitance
RADCIN
Input On Resistance
Typ
Max
Unit
Notes
2.5
V
Internal 2.5V reference voltage used.
100
nA
2
1
pF
MΩ
Table 2.10
2.11 Comparator
Symbol
Parameter
Min
VCMPIN
Input Voltage Range
0
VCMPOFST
Offset Voltage
-12
VCMPHYST
Hysteresis
Typ
0
50
Max
Unit
Vdd
V
12
mV
mV
Table 2.11
19
Notes
3 System
3.1 Overview
The general overview of system components is shown in Figure 3.1-1. The system internally consists of four main parts:
•
•
•
•
•
•
•
•
•
•
•
•
CORE – the main processing part of the microcontroller firmware responsible for managing all system tasks,
parsing and the execution of commands received from the user’s master controller.
RFID – dedicated RFID IC together with its firmware drivers responsible for communication with the RFID tag.
POWER MANAGER – a subsystem responsible for managing power states and clocks in the module to minimise
power consumption during operation.
UART – communication module providing a command protocol over the UART interface.
TEMPERATURE SENSOR – on-chip analog sensor measuring the microcontroller’s die temperature.
ADC + MUX – Analog to Digital Converter with a Multiplexer used to measure voltage on one of three sources:
temperature sensor, power supply voltage divider and external input.
Vdd DIVIDER – digitally controlled potentiometer used to divide the voltage in 1/63 steps.
IDAC – Digital to Analog Converter with current-type output.
COMP – configurable low power comparator with output available on one of the IOs.
VOLTAGE REFERENCE – on-chip 1.25V and 2.5V precise voltage references.
PWM GENERATOR – module providing configurable generation of a PWM signal with configurable duty cycle.
IO SYSTEM – module managing the General-Purpose Input-Output pins of the module.
20
ANT1
RFID
ANT2
TX
UART
RX
Temperature
Sensor
ADC + MUX
ADC IN
Vdd Divider
IDAC
COMP
CORE
Voltage
Reference
IDAC OUT
NEG IN
POS IN
COMP OUT
3x PWM
Generator
3x PWM Output
IO0 / PWM0
IO System +
MUX
IO1/PWM1/CMPOUT
IO2 / PWM2
IO3
nSLEEP
POWER MANAGER
Figure 3.1-1
21
nPWRDN
3.2 Modules
Core
The core of the system shown above in Figure 3.1-1, is the part of the modules’ hardware and firmware responsible
for managing tasks, prioritizing them and allocating resources to other components in the system. When the user
sends a command, the core is the part of the system which ensures that the command is executed properly, that the
outcome is saved and that a response is sent back to the user’s master controller.
RFID
The RFID component is the part of the hardware and module firmware responsible for the complete
communication interaction with the transponder via RF. In the RFID B1 module this part currently provides
communication capabilities with MIFARE Classic®, MIFARE Ultralight® and NTAG2xx® transponder types. The key
features of this RFID section are both fastest speed of transmission and system responsiveness, and optimal low power
consumption.
Power Manager
The Power Manager is the part of the firmware, together with hardware support, that manages the power states of
the system and tries to minimize power consumption as much as possible. The user has the option to put the module
into Power Down Mode by pulling low the nPWRDN pin.
When the system enters Power Down Mode, all clocks and submodules are disabled and no response to user
communication commands will occur until the system is re-enabled by the nPWDN being taken high by the user’s
system.
UART
The UART component of the RFID B1 module is responsible for the entire communication with the user master
controller, together with parsing commands for subsequent execution by the module core. The default baud rate is
9600. The user has the option to change this setting using only a single command. Communication via the UART
interface is in a command-response format, where the user first sends commands and the module then replies to each
command. There are also asynchronous packets sent to the user whenever an enabled interrupt is generated. Possible
interrupt sources are IO state changes, comparator output state change and RFID command execution end.
22
Temperature Sensor
The Temperature Sensor of the RFID B1 is analog. The voltage generated by the sensor is proportional to the
temperature of the microcontroller’s die. The system can measure this voltage and therefore calculate the
temperature of the die when requested.
ADC + MUX
The Analog to Digital converter together with the analog multiplexer in the module can measure the voltage of various
sources. The source is determined by the user selected multiplexer configuration. There are three possible input
configurations of the multiplexer: Temperature Sensor, External Input (ADC IN) and Power Supply divider. The
multiplexer is configured automatically when using the ADC and no special actions from the user are required for this
configuration.
Vdd Divider
The Vdd Divider module is based on a digital potentiometer and divides the power supply voltage by a user selected
value. This divided value could be used to measure the power supply voltage using the ADC or by supplying a reference
voltage to the positive input of the comparator. The Power Supply is divided per following formula:
𝑉𝑟𝑒𝑓 = 𝑉𝑑𝑑 ∗
𝐷𝑖𝑣𝑖𝑑𝑒𝑟 𝑉𝑎𝑙𝑢𝑒
.
63
IDAC
The Digital to Analog converter generates the user selected current flow through the IDAC output pin. The IDAC can
be configured as a current source or sink.
Comparator
The Comparator is a general purpose and low power and can be used for voltage level detection. In addition to its
output pin, the comparator can generate system interrupts and send asynchronous UART packets if there is a change
of its output state. When enabled the output pin is a push-pull type IO with no pull-up or pull-down resistors. When
disable command is executed the output pin is disabled regardless of the previous settings.
Voltage Reference
The Voltage Reference is used to generate the user selected reference voltage for the positive input of the comparator.
23
PWM Generator
The PWM Generator if based on a timer and is used to generate PWM signals on the IO pins. These signals are typically
for user interaction like flashing LEDs or driving sounder but also not standard use can be implemented.
IO System
The IO System is the front-end of the General-Purpose Input-Output pins and manages the usage and configuration of
the IO pins. The IOs can be configured as input, output low, output high or disabled. They don’t have any pull-up or
pull-down resistors.
TPI – Tag Presence Indicator
The TPI output is automatically set to low state every time that presence of a tag is detected (after executing the
commands: GetUIDandType, EnumerateTagsUID, EnumerateTagsUIDandType, Polling) The TPI output is set to the high
state if there is no Tag in range or if any error in Tag communication occurs. The state is updated with every requested
RFID command that undertakes communication with the Tag.
3.3 Memory Map
The device memory layout is shown below in Table 3.33.
In the RFID B1 module there are 728 bytes of user accessible memory. Each byte of the memory has a defined factory
default value and these values can be recovered by using the ‘Reset to Factory Defaults’ command. The first 288 bytes
are volatile memory which also have a default reset state that is the same as the factory default value. The other
memory is buffered non-volatile memory and can be modified and stored using ‘Unlock’ and ‘Lock’ commands. The
RFID B1 module is automatically returned to factory default state if after power up there is no valid configuration
stored in non-volatile memory. The first 288 bytes of this user accessible memory are not stored in non-volatile
memory and are always reset to factory defaults after a power-up sequence or after exit from the Power Down Mode.
Reading and writing to the registers can be done using the UART Read (0x02) and Write (0x01) commands. The rest of
the memory is accessible only when the module is unlocked. The default state of the module after power up is locked.
24
Address [DEC] Address [HEX] Size [bytes]
0
1
2
20
30
31
32
288
296
312
328
344
360
366
372
378
384
390
396
402
408
414
420
426
432
438
444
450
456
462
468
474
480
486
492
498
504
510
516
522
528
534
540
546
552
558
564
570
576
582
588
594
600
0x0000
0x0001
0x0002
0x0014
0x001E
0x001F
0x0020
0x0120
0x0128
0x0138
0x0148
0x0158
0x0168
0x016E
0x0174
0x017A
0x0180
0x0186
0x018C
0x0192
0x0198
0x019E
0x01A4
0x01AA
0x01B0
0x01B6
0x01BC
0x01C2
0x01C8
0x01CE
0x01D4
0x01DA
0x01E0
0x01E6
0x01EC
0x01F2
0x01F8
0x01FE
0x0204
0x020A
0x0210
0x0216
0x021C
0x0222
0x0228
0x022E
0x0234
0x023A
0x0240
0x0246
0x024C
0x0252
0x0258
1
1
18
10
1
1
256
8
16
16
16
16
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
128
Description
Access
Locked and Stored in nonvolatile memory
Result
Command
Command Parameters
Tag UID
Tag Type
Tag UID Size
Data Buffer
Password
AES Initialization Vector 0
AES Initialization Vector 1
AES Key 0
AES Key 1
Authentication Key / Password 0
Authentication Key / Password 1
Authentication Key / Password 2
Authentication Key / Password 3
Authentication Key / Password 4
Authentication Key / Password 5
Authentication Key / Password 6
Authentication Key / Password 7
Authentication Key / Password 8
Authentication Key / Password 9
Authentication Key / Password 10
Authentication Key / Password 11
Authentication Key / Password 12
Authentication Key / Password 13
Authentication Key / Password 14
Authentication Key / Password 15
Authentication Key / Password 16
Authentication Key / Password 17
Authentication Key / Password 18
Authentication Key / Password 19
Authentication Key / Password 20
Authentication Key / Password 21
Authentication Key / Password 22
Authentication Key / Password 23
Authentication Key / Password 24
Authentication Key / Password 25
Authentication Key / Password 26
Authentication Key / Password 27
Authentication Key / Password 28
Authentication Key / Password 29
Authentication Key / Password 30
Authentication Key / Password 31
Authentication Key / Password 32
Authentication Key / Password 33
Authentication Key / Password 34
Authentication Key / Password 35
Authentication Key / Password 36
Authentication Key / Password 37
Authentication Key / Password 38
Authentication Key / Password 39
User Memory
Read Only
R/W
R/W
Read Only
Read Only
Read Only
R/W
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
R / W when unlocked
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Table 3.3
25
Result Register
The Result Register is 1-byte long, located at address 0x0000, with both read only access. Writing to this register has
no effect. The register contains the result (error code) of the last executed command. The list of all possible results is
shown in Table 3.3.1.
Result Register Values
Value
Type
0x00
No Error
0x01
0x02
0x03
Invalid Command
Invalid Command Parameter
Indexes Out Of Range
Error When Writing To Non
Volatile Memory
System Error
Tag CRC Error
Tag Collision
Tag is not present
Tag Authentication Error
Tag Value Block Corrupted
Module Overheated
Tag Not Supported
Tag Communication Error
Invalid Password
Already Locked
Module Busy
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
0xFF
Description
Command was executed successfully, and results were stored in the
registers.
Value written to command register is invalid.
One of the parameters taken by the command is invalid.
Indexes passed as command parameters exceed limit.
There was an internal error during writing to the non-volatile memory.
Internal system error. Shall be considered as fatal.
During communication with the tag a CRC was not correct.
Module cannot handle anticollison procedure.
There is no tag within range.
Authentication failed due to incorrect Authentication Key or Password.
At least one value block is corrupted in the tag memory.
An overheat was detected.
There is a tag in the field which is not supported.
There was an error during communication with the tag.
The Password used in the Unlock command string was invalid.
You are trying to lock a module that is already locked.
Your command was ignored because the module is busy. Retry later.
Table 3.3.1
26
Command Register
The Command Register is 1-byte long, located at address 0x0001, with both read and write access. Writing to this
register is recognized by the module as a command execution request. Depending upon the command (value written
to the register) the Command Parameters Register is parsed to extract arguments for the command. Whilst commands
are executing the Result Register value is set to 0xFF and any write to the RFID Module memory is discarded. When
command execution is complete the memory together with the Result Register is updated and an asynchronous packet
is sent indicating that the module is ready to receive another command or generally that a write to the RFID Module
memory can be performed.
Command Parameters Register
Register Name
Register Address
Byte Offset
Access
Factory Default Value
Read Function
Write Function
0x00
R/W
0x00
0x01
R/W
0x00
0x02
R/W
0x00
0x03
R/W
0x00
0x04
R/W
0x00
0x05
R/W
0x00
0x06
R/W
0x00
Command Parameters
0x0002
0x07
0x08
0x09
0x0A
R/W
R/W
R/W
R/W
0x00
0x00
0x00
0x00
0x0B
R/W
0x00
0x0C
R/W
0x00
0x0D
R/W
0x00
0x0E
R/W
0x00
0x0F
R/W
0x00
0x10
R/W
0x00
0x11
R/W
0x00
Parameters taken when executing commands. Each command has various number and order of parameters.
Table 3.1.3
The Command Parameters Register is 18-bytes long, located at address 0x0002 to 0x0013, with both read and write
access. This is the place from where the system parses the arguments necessary to perform the requested operation
when a command is executed. Depending upon the command, this register is parsed and interpreted in different ways.
The details of interpretation of the data stored in this register can be found in chapter 5.3. The module never changes
the values inside this register except after power-up or exit from Power Down Mode.
Tag UID Register
Register Name
Register Address
Byte Offset
Access
Factory Default Value
Read Function
0x00
R
0x00
UID[0]
0x01
R
0x00
UID[1]
0x02
R
0x00
UID[2]
0x03
R
0x00
UID[3]
Tag UID
0x0014
0x04
0x05
R
R
0x00
0x00
UID[4]
UID[5]
0x06
R
0x00
UID[6]
0x07
R
0x00
UID[7]
0x08
R
0x00
UID[8]
0x09
R
0x00
UID[9]
Table 3.3.2
Tag UID Register is 10-bytes long, located at address 0x0014 to 0x001D, with read only access. In most cases the tag
UIDs are 4 bytes, 7 bytes or 10 bytes long, thus this register can cover the longest UID but not necessarily all bytes
available in the register will be used. Bytes within the register are ordered from the least significant byte to the most
27
significant byte. This register is updated whenever Get UID and Type commands are used. The tag UID Size Register
contains information detailing how many bytes of the ten available represent the tag UID.
Tag Type Register
The Tag Type Register is 1-byte long memory space at address 0x001E with read only access. This register contains
information about the type of the tag which was last seen in the field. Possible tag types are shown in Table 3.3.3.
Returned value
Tag type
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
0x10
No Tag
Incomplete Type
Ultralight
Ultralight EV1 80B
Ultralight EV1 164B
Classic Mini
Classic 1K
Classic 4K
NTAG203F
NTAG210
NTAG212
NTAG213F
NTAG216F
NTAG213
NTAG215
NTAG216
Unknown
Table 3.3.3
Tag UID Size Register
The Tag UID Size Register is 1-byte long, located at address 0x001F, with read only access. It contains the information
of what the UID size in bytes was of the last tag in the field.
Data Buffer
The Data Buffer is a 256-byte long, located at address 0x0020 to 0x011F, with both read and write access. This buffer
is used for data transfers between the tag and the user of the module.
28
Password Register
Register Name
Register Address
Byte Offset
Access
Factory Default Value
Read Function
Write Function
Password
0x0120
0x00
R/W
0x00
0x01
R/W
0x00
0x02
R/W
0x00
0x03
R/W
0x00
0x04
R/W
0x00
0x05
R/W
0x00
0x06
R/W
0x00
0x07
R/W
0x00
PASS[0]
PASS[1]
PASS[2]
PASS[3]
PASS[4]
PASS[5]
PASS[6]
PASS[7]
Table 3.3.8
The Password Register is 8-bytes long, located at address 0x0120 to 0x0127, with both read and write access but only
after first unlocking the device. This register is inaccessible when the module is locked. It contains an 8-byte long
password which must be used with the Unlock Command to unlock protected memory. This password can be changed
when the device is unlocked. The password change will only be updated and become valid after executing the Lock
command.
AES Initialization Vector Register
AES Initialization Vector
Register Name
0x0128,0x0138
Register Address
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
Byte Offset
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Access
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
Factory Default Value
Read Function
InVec[0] InVec[1] InVec[2] InVec[3] InVec[4] InVec[5] InVec[6] InVec[7] InVec[8] InVec[9] InVec[10] InVec[11] InVec[12] InVec[13] InVec[14] InVec[15]
Write Function
Table 3.3.9
The AES Initialization Vector Registers are two 16-bytes long registers, located at address 0x0128 to 0x0147, with both
read and write access but only after first unlocking the device. These registers are inaccessible when the module is
locked. They can be used as an initialization vector for the first encrypted data block. The byte order in the memory is
from the least significant byte. Their role during data encryption and decryption is described in detail in chapter 5.2.8
and 5.2.9.
29
AES Key Register
Register Name
Register Address
Byte Offset
Access
Factory Default Value
Read Function
Write Function
0x00
R/W
0x00
0x01
R/W
0x00
0x02
R/W
0x00
0x03
R/W
0x00
0x04
R/W
0x00
0x05
R/W
0x00
0x06
R/W
0x00
AES Key
0x0148, 0x0158
0x07
0x08
R/W
R/W
0x00
0x00
Key[0]
Key[1]
Key[2]
Key[3]
Key[4]
Key[5]
Key[6]
Key[7]
Key[8]
0x09
R/W
0x00
0x0A
R/W
0x00
0x0B
R/W
0x00
0x0C
R/W
0x00
0x0D
R/W
0x00
0x0E
R/W
0x00
0x0F
R/W
0x00
Key[9]
Key[10]
Key[11]
Key[12]
Key[13]
Key[14]
Key[15]
Table 3.3.10
The AES Key Registers are two 16-bytes long registers, located at address 0x0148 to 0x0167, with both read and write
access but only after first unlocking the device. These registers are inaccessible when the module is locked. Both
registers contain an AES encryption key which can be used for encryption of the Data Buffer. Their role during
encryption and decryption of the data in the buffer is described in detail in chapter 5.2.8 and 5.2.9.
Authentication Key / Password Register
Register Name
Register Address
Byte Offset
Access
Factory Default Value
Read Function
Write Function
0x00
R/W
0x00
KEY[0] /
PASS[0]
Authentication Key / Password
0x0168, 0x016E … 0x0252
0x01
0x02
0x03
0x04
R/W
R/W
R/W
R/W
0x00
0x00
0x00
0x00
KEY[1] / KEY[2] / KEY[3] /
KEY[4]
PASS[1] PASS[2] PASS[3]
KEY[0] /
PASS[0]
KEY[1] /
PASS[1]
KEY[2] /
PASS[2]
KEY[3] /
PASS[3]
KEY[4]
0x05
R/W
0x00
KEY[5]
KEY[5]
Table 3.3.11
The Authentication Key and Password Registers are forty 6-bytes long registers, located at address 0x0168 to 0x0257,
with both read and write access but only after first unlocking the device. These registers are inaccessible when the
module is locked. When working with MIFARE Classic® tags these registers contain the password keys used for block
authentication in the tag. When working with Ultralight® and NTAG® transponders, these registers contain 4-byte
passwords. There are forty Authentication Key and Password registers numbered from 0 to 39. The number of the
key register to be used is passed as an argument in some commands.
30
User Memory
There are 128 bytes of memory available for the user as a protected memory space from address 0x0258 to 0x02D7.
This memory is inaccessible when the device is locked. This data is stored into non-volatile memory when the Lock
command is executed.
If the first byte in User Memory is 0x22, then the module tries to execute Polling command. See chapter 5.5 Polling
Mode for details.
31
4 Communication Interface
4.1 Overview
The B1 module provides an asynchronous UART communication interface. The default baud rate is 9600 bps. The user
has the option to change the transmission baud rate by using dedicated command. New settings are automatically
stored in the non-volatile memory.
Communication is of a packetized command-response format which means that after every packet is sent from the
master there will be a response packet sent back by the module. Apart of this type of user-master generated
communication, the module also autonomously sends asynchronous packets when, for example an interrupt is
triggered.
All data sent via the UART in both directions is and must be packetized. Each packet consists of a Packet Header and
Packet Data. The B1 module provides several options for user selectable Packet Header and Packet Data configuration.
Packet Data can be configured as Plain or Encrypted (using AES-128 encryption). The Packet Header has two
configuration options: Type A and Type B. To best suit user requirements, both Packet Data and Packet Header are
configurable independently.
4.2 Interface Signals
UART interface is available to the user as two communication lines – receive RX and transmit TX. On the RX line the
information is transmitted from the master to the B1 module. The RX line is configured as an input on the B1 module
side without any pull-up or pull-down resistors, thus it cannot be left floating. On the TX line the information is
transmitted in the opposite direction. This line is driven by the module to ground or to Vcc.
The UART frame timing diagram is shown in Figure 4.2. During communication, the LSB is transmitted first and the MSB
is transmitted last. The protocol is configured with one start bit, eight data bits, one stop bit and no parity bits.
START
BIT0
BIT1
BIT2
BIT3
Figure 4.2
32
BIT4
BIT5
BIT6
BIT7
STOP
4.3
Communication Protocol
The set of UART commands provided by the module is shown in Table 4.3.13.2. The module replies to each command
with an ACK once received. If any command received is not recognized, invalid parameter was sent or there is an error
during communication, then the module replies with either the Invalid Command (0x01) or the Invalid Command
Parameter (0x02) or the Protocol Error (0x03) packets. The module also sends asynchronous packets upon either startup, or when an IO interrupt has been triggered, or when the Comparator Output Pin changes state, or when any RFID
Command is executed. A full list of UART responses is shown in Table 4.3.1.
Value
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
Type
Response Packets
Description
Command was received and processed
ACK (No Error)
sucessfully.
Invalid Command
Command byte is invalid.
One of the parameters supplied within the
Invalid Command Parameter
command is invalid.
Protocol Error
Packet received cannot be interpreted.
Memory allocation error when processing
Memory Error
data.
Fatal error generated to indicate that the
System Error
system is not working correctly
Sent when the time delay between bytes
Module Timeout
in a packet is over 100milliiseconds.
Overflow
Input buffer overflow.
Sent when an asynchronous event is
Asynchronous Packet
generated.
Sent when the module is busy with the
execution of an RFID command and the
Busy
user has tried to write data to the RFID
module memory or to put it into sleep
mode.
System Start
First packet send after power up.
Table 4.3.1
33
Additional Data
Dependant upon the
command
Parameter Number
Data Byte with events
flags.
-
-
Command
Command Description
number
Arguments Taken
0x00
Dummy command
-
0x01
Write to RFID Memory
Address, Data Size, Data
0x02
Read from RFID Memory
Address, Data Size
0x03
Enter Sleep Mode
-
0x04
Reset
-
0x05
Set Baud Rate
Baud Rate Value
0x06
Set Data Type
Data Type
0x07
Set Header Type
Header Type Configuration
0x08
Set IO State
IO Number, IO State
0x09
Read IO State
IO Number
0x0A
Set IO Interrupt
IO Number, Interrupt Configuration
0x0B
Measure Voltage
Source, Value Format
0x0C
Measure Die Temperature
Value Format
0x0D
Set IDAC Current
Value Format, Current Value
0x0E
Enable Comparator
0x0F
Disable Comparator
0x10
Enable PWM
IO Number, Duty Cycle, Value Format,
Frequency / Period Value
0x11
Set AES Init Vector
Initialization Vector
0x12
Set AES Key
128-bit Key
0x13
0x14
Read AES Init Vector
Read AES Key
-
Valid Command
Respone
Table 4.3.1
34
Possible
Async
Packets
Protocol Error,
Invalid Parameter
Protocol Error,
ACK, RFID Processing
RFID Command
Invalid Parameter,
Finished
End
Busy
Protocol Error,
ACK, Data
Invalid Parameter
ACK
Protocol Error
Protocol Error,
ACK, System Start
System Error
Protocol Error,
ACK, Real Baud Rate
Invalid Parameter
Protocol Error,
ACK
Invalid Parameter
Protocol Error,
ACK
Invalid Parameter
Protocol Error,
ACK
Invalid Parameter,
System Error
Protocol Error,
ACK, IO State
Invalid Parameter,
System Error
Protocol Error,
ACK
Invalid Parameter,
IO Edge
System Error
Protocol Error,
ACK, Voltage Value
Invalid Parameter,
System Error
Protocol Error,
ACK, Temperature Value Invalid Parameter,
System Error
Protocol Error,
ACK, Current Value
Invalid Parameter,
System Error
Protocol Error,
Comparator
ACK
Invalid Parameter,
Edge
System Error
ACK
Protocol Error
Protocol Error,
ACK
Invalid Parameter,
System Error
Protocol Error,
ACK
System Error
Protocol Error,
ACK
System Error
ACK, Initialization Vector
Protocol Error
ACK, AES Key
Protocol Error
ACK
Reference Voltage, Output Pin
Configuration, Async Packet
Configuration, Power Supply Divider
-
Possible Errors
4.4 CRC Calculation
Some communication and commands require CRC calculations to be performed by the B1 module. In all such cases the
CRC used for calculation is a 16-bit CRC-CCITT with a polynomial equal to 0x1021. The initial value is set to 0xFFFF, the
input data and the output CRC is not negated. In addition, no XOR is performed on the output value. The result of the
CRC is always stored in memory with the least significant byte first. Example C code is shown below.
static const uint16_t CCITTCRCTable [256] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5,
0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b,
0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210,
0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c,
0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401,
0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b,
0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6,
0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738,
0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5,
0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969,
0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96,
0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc,
0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03,
0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd,
0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6,
0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a,
0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb,
0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1,
0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c,
0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2,
0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb,
0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447,
0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8,
0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2,
0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9,
0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827,
0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c,
0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
35
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0,
0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d,
0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07,
0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba,
0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74,
0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
static uint16_t GetCCITTCRC(const uint8_t* Data, uint32_t Size) {
uint16_t CRC;
uint16_t Temp;
uint32_t Index;
if (Size == 0) {
return 0;
}
CRC = 0xFFFF;
for (Index = 0; Index < Size; Index++){
Temp = (uint16_t)( (CRC >> 8) ^ Data[Index] ) & 0x00FF;
CRC = CCITTCRCTable[Temp] ^ (CRC > 8) ^ Data[Index] ) & 0x00FF;
CRC = CCITTCRCTable[Temp] ^ (CRC