RFID sessions determine how tags behave when a reader inventories them. The EPC Gen2 protocol defines four sessions: S0, S1, S2, and S3. Each session operates independently. A tag inventoried in one session remains responsive to readers using a different session.
The inventoried flag
Every tag maintains an inventoried flag for each session. This flag has two states: A and B. When a reader inventories a tag, the tag flips its flag from A to B. The tag then stops responding to that reader until the flag returns to A.
This mechanism prevents the same tag from being read repeatedly during a single inventory round.
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#0ea5e9', 'primaryTextColor': '#fff', 'primaryBorderColor': '#0ea5e9', 'lineColor': '#94a3b8', 'secondaryColor': '#1e293b', 'tertiaryColor': '#1e293b', 'background': '#0f172a', 'mainBkg': '#1e293b', 'nodeBorder': '#0ea5e9', 'clusterBkg': '#1e293b', 'titleColor': '#fff', 'edgeLabelBackground': '#1e293b'}}}%%
stateDiagram-v2
direction LR
[*] --> A: Power on
A --> B: Inventoried by reader
B --> A: Persistence timeout
B --> A: Target reversal command
Session persistence
Each session has a different persistence time for the inventoried flag:
| Session | Persistence | Typical Use |
|---|
| S0 | Nominal (resets quickly) | Fast, continuous reads |
| S1 | 500ms to 5 seconds | Portal reads, conveyor systems |
| S2 | 2 seconds minimum | Multiple readers, dense populations |
| S3 | 2 seconds minimum | Long dwell time applications |
S0 resets almost immediately after losing power from the reader field. S1, S2, and S3 retain their state for longer periods even when the tag leaves the field.
Choosing the right session
Your session choice depends on your application requirements.
Use S0 when you need continuous visibility of all tags. A handheld reader scanning inventory benefits from S0. You see every tag on every scan.
Use S1 for portal applications. Tags passing through a dock door get read once. The flag persists long enough to prevent duplicate reads during transit. The flag resets before the tag returns on the next shipment.
Use S2 or S3 when multiple readers cover the same area. Each reader operates on a different session. A tag read by Reader A on S2 still responds to Reader B on S3. This prevents read collisions in dense deployments.
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#0ea5e9', 'primaryTextColor': '#fff', 'primaryBorderColor': '#0ea5e9', 'lineColor': '#94a3b8', 'secondaryColor': '#1e293b', 'tertiaryColor': '#1e293b', 'background': '#0f172a', 'mainBkg': '#1e293b', 'nodeBorder': '#0ea5e9', 'clusterBkg': '#1e293b', 'titleColor': '#fff', 'edgeLabelBackground': '#1e293b'}}}%%
flowchart TD
subgraph Application["Application Type"]
A[Handheld inventory] --> S0[Session S0]
B[Portal / conveyor] --> S1[Session S1]
C[Multi-reader zone] --> S2[Session S2/S3]
end
subgraph Result["Behavior"]
S0 --> R0[Tags always respond]
S1 --> R1[Tags respond once per pass]
S2 --> R2[Independent per reader]
end
Target commands
Readers send commands specifying which target state to inventory. A reader targeting state A only receives responses from tags with their flag set to A. After the read, those tags flip to B.
The reader then has two options:
- Continue reading state A to find new tags entering the field
- Send a target reversal to flip all B tags back to A
Target reversal resets the entire population for another inventory round. This approach works well for fixed tag populations where you want to count all tags periodically.
Dense tag populations
Sessions become critical when reading hundreds or thousands of tags. Without proper session management, the reader wastes time re-reading tags already inventoried.
A typical approach for dense populations:
- Set session to S2 or S3
- Inventory all tags in state A
- Tags flip to B as they respond
- New tags entering the field remain in state A
- Reader continues finding only new arrivals
- Periodically reverse target to re-inventory everything
This pattern maximizes throughput. The reader focuses on unread tags instead of processing duplicates.
Common mistakes
Reading with S0 in a dense environment causes poor performance. The reader keeps re-reading the same tags because the flag resets too quickly.
Using S2/S3 on a handheld causes missed reads. Tags inventoried minutes ago still have their flag set to B. They appear missing until the persistence timeout expires.
Mixing sessions across a multi-reader deployment without planning causes gaps. Coordinate which reader uses which session to ensure complete coverage.
Implementation notes
Most RFID readers default to S0 or S1. Check your reader documentation for session configuration options. Some readers expose session selection through their API. Others require firmware configuration.
When building software that interfaces with RFID readers, expose session selection to your users. Different deployment scenarios need different sessions. A configuration option prevents field issues.
Test your session configuration with your actual tag population. Simulated environments often miss the timing sensitivities that appear in production deployments.