binary search
DESCRIPTION
binary search for rfidTRANSCRIPT
Tree Search Algorithms in NFC and RFID Systems
EE 260: RFID Systems Robert Morelos-‐Zaragoza San José State University
Tree search [1]
13
Anticollision: Slotted ALOHA
| Tags only transmit packets at pre-defined points in time (slots)| Synchronized by reader| Example: 1 Reader, 5 Tags, 8-bit ID
t
Tag 5
Tag 4
Tag 3
Tag 2
Tag 1
Reader INVENTORY
11010110
10010001collision!
Slot 1
11110110
11110111
collision!
Slot 2
10000001
Slot 3Reader-Slot
SELECT10000001
Reader-Slot
slot length
Anticollision: Binary Search
| "Tree Walking"| Recursive depth-first search| Requirement: Reader is able to detect bit position of a collision| Example: 1 Reader, 3 Transponder, 3-bit ID
000 001 010 011 100 101 110 111
0
00 01
1
10 11
Tag present
collision!
collision!
1003rd iteration
1X02nd iteration
XXX1st iteration
012Bit numberReceived data at reader
EE 260 -‐ SJSU Tree Search Algorithms in RFID 2
EPC UHF Class-‐1 GeneraNon-‐1 [2]
bin, it can request the full EPC of the tag.
Class 1 memory organization is fairly simple: memory is organized in 7 or 9 rows of 2 bytes each. The CRC occupies the first row, the EPC (most-significant-byte first) the next five or seven rows. (The astute reader will note that this is two more bytes than are actually required to carry the EPC. The class 1 error check uses a sequence of 16 '0' bits after the EPC; curiously these bits are programmed into the tag even though the calculation is only performed by the reader, which could certainly insert the bits under program control.) The last row contains the lock byte, which is set to hexadecimal A5 to prevent further writing of the tag, and the kill password. Since the kill password is only 8 bits long, some commercial tags time out after a failed KILL attempt in order to prevent a dictionary attack, otherwise very simple since there are only 256 possible codes. The 64-bit EPC map is shown below; the 96-bit map adds the requisite EPC rows. It is important to note that at least some class 1 tags are not rendered non-functional when KILLed, but merely erased.
Page 7 of 11The RF in RFID: RFID protocols
11/28/2007http://www.enigmatic-consulting.com/Communications_articles/RFID/RFID_protocols.h...
EE 260 -‐ SJSU Tree Search Algorithms in RFID 3
Binary Tree Search [3] • n: number of all the possible tags in RFID system • k: length of bit stream to present a tag, equal to the depth of the binary tree
k = ⌈log2n⌉ • m: number of tags exist in the interrogaNon field of reader • Nxy: yth node at depth x of the tree • Txy: subtree whose root node is Nxy
EE 260 -‐ SJSU Tree Search Algorithms in RFID 4
Mathematical Problems in Engineering 5
0
0
0
0
1
1
1
1
Depth
0
1
2
3
4
1 1 1 1 1 1
0 1 0 1 0 1
0 0 0 0 0 0 0 1
0 1
N48
Figure 2: The structure of Binary Search Tree !m " 5, k " 4#.
the next bit of the first subset. If there is still a collision, the further splitting proceedsrecursively; otherwise tags in this subset are identified and no subsets will be queried untilno collision in the former subset.
Figure 2 shows an example of binary tree whose depth is 4. Each tag corresponds to aleaf node in the binary search tree. There are 5 tags with Tag ID of 4-bit length in this example.For example, the ID of tag N48 is 1000.Some parameters of the searching procedure of Binary Search Tree are defined as follows:
n: the number of all the possible tags in this RFID systemk: the length of bit stream to present a tag, it is equal to the depth of the binary tree.k " !log2n"m: the number of tags exist in the interrogation field of readerNxy: the yth node at depth x of the treeTxy: the subtree whose root node is Nxy.
The searching procedure of Binary Search Tree is stated as follows.
!1# Begin with the root node N00, and ask if there is zero, one or more than one tag inthe subtree T00.
!2# If there are more than one tag in T00, it means there is a collision that happened atN00. Then ask the 2 succeeding nodes, N10 and N11, to check whether there is zero,one, or more than one tag in their subtrees. If the first node N10 has collisions, letthe second node N11 wait and ask the same question to succeeding nodes of N11.The process follows the principle of “first in, first out.”
!3# Recursively, if there is any collisions at nay node, repeat the same question to itssucceeding nodes until there is no collision at the succeeding node.
If any node is waiting, resolve it by repeating step !3#. If there is more than one waitingnode, resolve them following the priority of “first in, first out.” The pseudo codes of thisalgorithm are shown in Algorithm 1.
At the end of the process, each leaf will contain at most one tag. In the example ofFigure 2, the order in which we find the tags is 1111, 1101, 1000, 0011, 0000. This algorithmneeds to search 4 stages for finding a tag successfully.
Binary Search Tree Procedure [3] ① Begin with the root node N00, and ask if there is zero,
one or more than one tag in the subtree T00
② If there are more than one tag in T00, it means there is a collision that happened at N00. Then ask the 2 succeeding nodes, N10 and N11, to check whether there is zero, one, or more than one tag in their subtrees. If the first node N10 has collisions, let the second node N11 wait and ask the same quesNon to succeeding nodes of N11. The process follows the principle of “first in, first out.”
③ Recursively, if there is any collisions at any node, repeat the same quesNon to its succeeding nodes unNl there is no collision at the succeeding node.
EE 260 -‐ SJSU Tree Search Algorithms in RFID 5
Example [4]: 8-‐bit ID numbers • Four tags:
• ResoluNon of collisions:
EE 260 -‐ SJSU Tree Search Algorithms in RFID 6
Search criterion
Reducing number of iteraNons [4] • Upon detecNon of a card (transponder 2 here), the number of
iteraNons necessary for the selecNon of another card – in the same round – can be subsequently reduced:
EE 260 -‐ SJSU Tree Search Algorithms in RFID 7
Dynamic binary search [4] -‐ I • Redundant data is exchanged in binary search algorithms:
• Reader sends only the known part (VB) of the serial numbers
in the REQUEST command together with the length “Number of valid bits (NVB) – Responses from cards with serial numbers matching search criterion
EE 260 -‐ SJSU Tree Search Algorithms in RFID 8
Valid bits (VB) or MASK
Dynamic binary search [4] -‐ II
• Same number of iteraNons as in binary search • Reduced amount of data transferred results in up to 50% reducNon
in total discovery Nme!
EE 260 -‐ SJSU Tree Search Algorithms in RFID 9
ISO 14443 Type-‐A Smart Cards [4] -‐ I
• Use a dynamic binary search tree algorithm
– If a card is detected then the reader requests full single (4 bytes) serial number (with NVB=40h) in the SELECT command
– Cards with double (7 bytes) or triple (10 bytes) serial numbers, signals this to the reader by sepng a “cascade bit” (b3=1) in the SAK (select-‐and-‐acknowledge) command
EE 260 -‐ SJSU Tree Search Algorithms in RFID 10
References [1] M. Handy, “RFID Technology,” RFID Workshop 2004, Berlin, Germany. Retrieved
4/9/12 from hsp://www.imd.uni-‐rostock.de/veroeff/handy_rfid_berlin.pdf
[2] D.M. Dobkin, “The RF in RFID: RFID protocols” hsp://www.engr.sjsu.edu/rmorelos/ee296f08/RFID_UHF_PHY.pdf Retreived 11/28/07 from hsp://www.enigmaNc-‐consulNng.com/CommunicaNons_arNcles/RFID
[3] B.Y. Shih, C.W. Chen, C.Y.. Chen and T.W. Lo, “Merged Search Algorithms for Radio Frequency IdenNficaNon AnNcollision,” Mathema3cal Problems in Engineering, Volume 2012 (2012), ArNcle ID 609035, doi:10.1155/2012/609035
[4] K. Finkenzeller, RFID Handbook: Fundamentals and ApplicaNons in Contactless Smart Cards and IdenNficaNon, Wiley, 2003, pp. 245-‐248.
EE 260 -‐ SJSU Tree Search Algorithms in RFID 12