ATR command when programming a PC / SC reader

I checked the programming interface for the MIFARE Ultralight and TOPAZ / Jewel tags. The API pretty well describes how bytes are stored on the card, how to handle memory blocks, how to perform all operations, such as reading, reading, using the OTP (one-time programmable) function, reading ROM bytes, how to switch from standby to standby mode ( commands REQA, WUPA), he says that if the teams are protected from CRC, how to access the UID, etc.

When I looked at the NFC reader program (ACR122U or SCL010), I found that all communication between the PCD (reader) of the PICC (tag) starts with the ATR (Answer-To-Reset) command, which is described on the Internet β€” the command that the PCD sends to the PICC for identification purposes.

But none of the tag documentation mentions the ATR command - all communication with tags when they are turned on (PQR) starts with the REQA, WUPA commands to switch the card to ready mode.

I understand that ATR is built on PC / SC based on the NFC card that the reader was associated with. As soon as the reader finds out what type of technology is a tag based on this, he creates an ATR. Also according to the ATR documentation for different NFC readers they differ for the same NFC tags.

I'm right? Does PC / SC create ATR?

BR sten

+6
source share
2 answers

Short answer:

  • You are correct that the ATR is generated by a PCSC reader.
  • I think the ATR will remain the same regardless of the reader for contactless cards.

Long answer:

ATR is designed for contact cards and is specified in ISO 7816. For contactless cards, this PC / SC (IFD) reader generates ATR.

ATR is based on:

  • ATS (choice answer) for Type A 14443 Type A cards
  • ATQB and ATTRIB bytes for ISO 14443 cards

ATR will look like 3B 8X 80 01 HB_ATS Parity_Byte where X is the number of bytes of historical ATS bytes (HB_ATS).

The precise ATR design for contactless cards is given in Section 3.1.3.2.3 PC / SC Specification.

Given that the only variable is ATS, it should be the same regardless of the reader.

- Sid

+13
source

ATR contains fixed fields as well as optional fields (conditional). Therefore, depending on some field values, subsequent fields may be omitted, so ATR may differ for different readers, but they all comply with the standards.

Check out the smart card tutorial here .
In short, the ATR frame looks like this:
enter image description here

+1
source

Source: https://habr.com/ru/post/890120/


All Articles