What are the commands for EPC Class1 Gen2 electronic tags?
Tags and readers that comply with the EPC Class 1 Gen2 (G2) protocol version V109 should have the following characteristics:
1. Label memory partition
Tag memory is divided into four independent Bank blocks: Reserved, EPC, TID, and User.
➣ Reserved:Store Kill Password and Access Password。
➣ EPC: Stores EPC numbers, etc.
➣ TID: Stores tag identification numbers, each TID number should be unique.
➣ User: Stores user-defined data.
In addition, there are also units that are also stored in the Lock status bit of each block.

Second, the status of the label
After receiving continuous wave (CW) irradiation and powering up, the tag can be in one of seven states: Ready, Arbitrate, Reply, Acknowledged, Open, Secured, or Killed.
➣ The Ready state is the state in which the label that has not been inactivated begins to be in after powering on, ready to respond to commands.
➣ The Arbitrate state is mainly used to wait for a response to a command such as a query.
➣ After responding to the Query, enter the Reply state, and then send back the EPC number by responding to the ACK command.
➣ After sending back the EPC number, enter the Accumulated state, which can further respond to Req_RN commands.
➣ Access Password is not set to 0 before you can enter the Open state, where you can read and write.
➣ Only when the Access Password is known can it enter the Secured state and perform operations such as read, write, and lock.
➣ Tags that enter the Killed state will remain unchanged and will never generate a modulated signal to activate the RF field, thus permanently invalidating. The inactivated tag should remain in the Killed state in all environments, and enter the inactivated state when powered on, and the inactivation operation is irreversible.
In order for a label to enter a certain state, a set of legal commands in the appropriate order is generally required, and in turn each command can only be effective if the label is in the appropriate state, and the label will also move to other states after responding to the command.

(UHF LED Illuminated Label)
3. Classification of commands
From the perspective of command architecture and extensibility, it is divided into four categories: Mandatory, Optional, Proprietary, and Custom.
From the perspective of the use function, it is divided into three categories: label Select (selection), Inventory (inventory) and Access (access) commands, in addition, in order to expand the command in the future, different encoding of different lengths is reserved for use.
4. Mandatory commands
Tags and readers that comply with the G2 protocol should support 11 commands:
➣ Select
➣ Query
➣ QueryAdjust
➣ QueryRep
➣ ACK
➣ TO
➣ Req_RN
➣ Read
➣ Write
➣ Kill
➣ Lock
5. Optional command
There are three optional commands for G2 protocol-compliant tags and readers: Access, BlockWrite, and BlockErase.

(Flexible Printable Anti-Transfer Label)
6. Proprietary
Proprietary commands are generally used for manufacturing purposes, such as in-house testing of labels, etc., and such commands should be permanently invalidated after the label leaves the factory.
七、Custom commands
It can be a command defined by the manufacturer itself and open to the user, such as Philips provides BlockLock, ChangeEAS, EASAlarm (EAS) and other commands (EAS is the abbreviation of Electronic Article Surveillance).
8. From a functional point of view: Select command
There is only one option: Select, which is required. Tags have a variety of attributes, based on the standards and policies set by the user, use the Select command to change some attributes and flags to artificially select or delineate a specific tag group, and only they can be inventoried and identified or accessed, which is conducive to reducing conflicts and duplicate identification, and speeding up the recognition speed.
9. From a functional point of view: Inventory commands
There are five items: Query, QueryAdjust, QueryRep, ACK, and NAK, all of which are required.
1. After the tag receives a valid Query command, each tag selected that meets the set criteria will generate a random number (similar to rolling the dice), and each tag with a random number of zero will generate an echo (send back the temporary password RN16, a 16-bit random number) and transfer to the Reply state; Tags that meet other criteria will change certain attributes and flags and thus leave the above tag groups, which can help reduce duplicate identification.
2. After the tag receives a valid QueryAdjust command, each tag will generate a new random number (like rerolling the dice), and the others will be the same as Query.
3. After receiving a valid QueryRep command, the tag only subtracts one from the original random number of each tag in the tag group, and the others are the same as Query.
4. Only a single tag can receive a valid ACK command (using the above-mentioned RN16, or the handle Handle, a 16-bit random number that temporarily represents the identity of the tag, which is a security mechanism), and send it back to the EPC area after receiving it, which is the most basic function of the EPC protocol.
5. After receiving a valid NAK command, the tag will be in the Arbitrate state except for the Ready and Killed states.

10. From a functional point of view: Access commands
There are five required ones: Req_RN, Read, Write, Kill, Lock, and three optional ones: Access, BlockWrite, BlockErase.
1. After receiving a valid Req_RN (with RN16 or Handle) command, the tag sends back a handle or a new RN16, depending on the status
2. After receiving a valid Read(with Handle) command, the tag sends back the error type code, or the content and handle of the required block.
3. After receiving a valid Write (with RN16 & Handle) command, the tag sends back an error type code, or sends back a handle if the write is successful.
4. After the tag receives a valid Kill (with Kill Password, RN16 & Handle) command, it sends back an error type code, or sends back a handle if the deactivation is successful.
5. After receiving the valid Lock(with Handle) command, the tag will send back the error type code, or send back the handle if the lock is successful.
6. After receiving a valid Access (with Access Password, RN16 & Handle) command, the tag sends back the handle.
7. After the tag receives a valid BlockWrite (with Handle) command, it sends back an error type code, or sends back the handle if the block is written successfully.
8. After the tag receives a valid BlockErase (with Handle) command, it sends back an error type code, or sends back the handle if the block is erased successfully.
11. What mechanism does the G2 use to avoid conflict?
As mentioned in the above answer, when more than one label with a random number of zero sends back a different RN16, they will have different RN16 waveforms superimposed on the receiving antenna, which is called collisions, and thus cannot be decoded correctly. There are a variety of anti-collision mechanisms to avoid waveform superposition and distortion, such as trying to make only one tag "speak" at a certain time, and then singling it to identify and write each tag in multiple UHF RFID tags.
The above three Q commands embody G2's anti-collision mechanism: if there are multiple tags with zero random numbers and cannot be decoded correctly, the Q command or combination will be strategically resent to the selected tag group until it can be decoded correctly.

12. How to achieve the uniqueness of the Label Identification Number (TID).
The Tag identifier (TID) is a sign of identity between tags (which can be analogous to the number of a banknote). From a security and anti-counterfeiting point of view, any two G2 labels should not be identical, and the labels should be unique. Each of the four storage blocks of the label has its own usefulness, and some can be rewritten at any time after leaving the factory, only the TID should also be able to play this role, so the TID of the label should be unique.
The manufacturer of the G2 chip should use the Lock command or other means to act on the TID to make it permanently locked, and the manufacturer or relevant organization should ensure that the TID of the appropriate length of each G2 chip is unique, and that there will be no second TID of the same type under any circumstances, even if a G2 tag is in the Killed state and will not be activated for reuse, its TID (still in this tag) will not appear in another G2 tag.
In this way, since the TID is unique, even though the EPC code on the label can be copied to another label, it can also be distinguished by the TID on the label, so that the source can be cleared. This architecture and method are simple and feasible, but care should be taken to ensure the unique logical chain.
The V109 version of the G2 protocol stipulates that only 32-bit is required for TID (including 8-bit allocation class identifier, 12-bit tag mask-designer identifier, 12-bit tag model number). For more bits, such as SNR (serial number), it is Tags may contain rather than should. However, since the EPC number is designed to be used to distinguish a single product, 32-bit is probably not enough, and SNR should be included.
13. Kill command in G2 protocol
The G2 protocol sets the Kill command, and it is controlled by a 32-bit password, and the tag will never generate a modulation signal to activate the RF field after the effective use of the Kill command, thus permanently invalidating. However, the original data may still be in the tag, and if it is not entirely impossible to read them, consider improving the meaning of the Kill command - with the data being erased.
In addition, within a certain period of time, due to the cost of using the G2 label or other reasons, the situation that the label can be recycled and reused will be taken into account (for example, the user wants to use the pallet and box with the label, and the corresponding EPC number and the content of the User area should be rewritten after the content is replaced; It is expensive and inconvenient to replace or reattach the label, etc.), and it is necessary to rewrite the content of the label even if it is permanently locked, because of the influence of different lock states, only using Write or BlockWrite, the BlockErase command may not be able to rewrite the EPC number, User content, or password (for example, the EPC number of the label is locked and cannot be rewritten, or the access of the label is not locked but forgotten). password instead of rewriting the EPC number). This creates a requirement for a simple and straightforward Erase command - except for the TID area and its Lock status bit (the label cannot be overridden after the TID is shipped from the factory), the contents of the EPC number, the reserved area, the User area, and other Lock status bits, even if they are permanently locked, will all be erased for rewriting.
In comparison, the functions of the improved Kill command and the added Erase command are basically the same (including that the Kill Password should be used), but the only difference is that the former Kill command does not generate a modulation signal, so that it can also be considered by the different values of the RFU of the parameters carried by the Kill command.
fourteenWhat if the tag or reader does not support optional (Access) commands?
If the BlockWrite or BlockErase command is not supported, it can be replaced by the Write command (write 16-bit at a time) several times, because erase can be regarded as writing 0, and the block of the former block write and block erase is several times the 16-bit, and other conditions of use are similar.
If the BlockWrite or BlockErase command is not supported, it can be replaced by using the Write command (writing 16-bit at a time) several times, because erasing can be considered as writing 0. The blocks of the former block write and block erase are several times 16-bit, and other usage conditions are similar.
If the Access command is not supported, the tag can enter the Secured state and use the Lock command only when the Access Password is 0. The Access Password can be changed in the Open or Secured state. If the Access Password is locked or permanently locked using the Lock command (pwd-read/write bit is 1, permalock bit is 0 or 1, refer to the attached table), the tag can no longer enter the Secured state and can no longer use the Lock command to change any lock state.
If the Access command is supported, it is possible to use the corresponding commands to freely enter all states. Except for the tag being permanently locked or permanently unlocked and refusing to execute certain commands and being in the Killed state, most commands can be effectively executed.