APDU Command Testing with an ACS Reader
← Back to the ACS testing and utilities centre
How do you test APDU commands with an ACS reader? Work from a written test plan, not from memory. Prove the reader first, then identify the card from its ATR, then send a short sequence of read-only commands chosen for that card type, and compare each reply with the reply the ACS manuals or PC/SC Part 3 say you should get. Record every command, reply and verdict in a results table. When a reply does not match, the status word tells you which troubleshooting step comes next.
This page is that test plan for ACS PC/SC readers (ACR1252U, ACR1552U and ACR122U for contactless cards, ACR39U for contact memory cards). It covers MIFARE Classic 1K, NTAG and Ultralight, MIFARE DESFire, and SLE4442 / SLE4428 memory cards, with the expected and unexpected replies for each command, a results table you can copy, and what to do with each failure. It does not explain how to install or drive the tools: the ACS Script Tool guide, the ACS Web APDU Tool guide, the ACS QuickView guide and the PC/SC Learning Tool guide do that. For what the bytes of an APDU mean, see how to send APDU commands (concepts). BSD Infotech is an independent ACS supplier and integrator, not the manufacturer.
BSD test pending. Every expected reply on this page comes from the ACS reader manuals or the PC/SC Part 3 specification (see Sources). BSD Infotech has not yet run this plan on its own readers and cards. Each expected reply is therefore marked "per ACS/PC/SC documentation; BSD test pending", and we will replace that note with our recorded results after the hardware session.
The Test Plan in Five Stages
A useful APDU test answers one question at a time. If the first command fails, the later ones tell you nothing, so the plan runs in a fixed order and stops at the first unexplained failure:
- Stage 0, the reader. Windows and the Smart Card service see the reader, and a tool sees a card arrive and leave. Expected result: the reader is listed and the card shows an ATR.
- Stage 1, identify the card. Read the ATR and decide which card type is on the reader. Expected result: the ATR matches the card type you think you have. Our smart card ATR guide explains how to read it.
- Stage 2, read-only commands for that card type. Run the sequence for the card (below). Expected result: each reply matches the documented reply.
- Stage 3, record. Write each command, the actual reply and pass or fail into the results table, together with the reader, firmware, Windows version and tool version.
- Stage 4, act on failures. Use the failure table to decide the next step, then repeat only the stage that failed.
Ground rules for every test
- Read-only. This plan contains no write commands, no key or code changes and no key recovery. The only authentication in it is the MIFARE Classic factory-key read, and that is run exactly as the MIFARE card test guide shows.
- Your own labelled test cards. Never test with a card from a live access, canteen or membership system.
- One card, one tool. Keep one card on the reader and close every other card program (QuickView, BSD utilities, your own software) before you send commands.
- The right reader entry. Contactless readers such as the ACR1252U and ACR1552U appear twice in Windows: send contactless tests to the entry whose name contains PICC, not to the SAM slot.
Which Tool for Which Stage
All four tools are free from ACS. Their guides cover download, installation and screens; this table only says which stage each one suits.
| Tool | Use it for | Why |
|---|---|---|
| ACS QuickView | Stage 0 and stage 1 | Lists the readers, shows card arrival and removal, and shows the ATR, without sending any command (how to read the ATR). |
| ACS Script Tool | Stage 2, the main test tool | Runs a whole sequence from a text file, checks each reply against an expected status word and saves a log you can keep as evidence (script format, saving logs). |
| ACS Web APDU Tool | Stage 2, single commands | Quick one-off commands from Chrome or Edge. No script files, so record the replies by hand. |
| ACS PC/SC Learning Tool | Stage 0 for developers | Shows the PC/SC calls (connect, card state, protocol, ATR) one by one, which helps when a tool works and your own program does not. |
If you would rather press buttons than type commands, the BSD reader utilities read the UID free and read factory-key cards with a BSD licence key. They are not APDU test tools, so they are not part of this plan.
Stage 0 and 1: Prove the Reader and Identify the Card
Run the three basic checks without code first (Device Manager, Smart Card service, a tool that sees the card). Then add these optional reader commands. They are read-only and documented only for the readers listed; do not send one model's reader command to another model.
| Test | Reader | Command | Expected reply (per ACS/PC/SC documentation; BSD test pending) |
|---|---|---|---|
| R1 Reader and card seen | All | None (QuickView) | Reader listed; card arrival and removal shown; an ATR appears while the card is present. |
| R2 Firmware version | ACR122U (the ACR1252U manual lists it among its ACR122U-compatible commands) | FF 00 48 00 00 | Firmware text in ASCII, for example ACR122U201. The ACR122U manual shows no status word after it. |
| R3 Firmware version | ACR39U, with a card inserted and connected | FF 09 00 00 11 | 11 bytes of firmware version text (ACR39x reference manual). |
| R4 Card type from the ATR | All | None (QuickView) | Contactless storage cards: an ATR starting 3B 8F 80 01 80 4F 0C A0 00 00 03 06 followed by the standard byte and the card name. Decode it with the contactless ATR tables. |
The ACR1252U and ACR1552U also report their firmware through escape commands (SCardControl), which these APDU tools may not send; see how to check the firmware version of an ACS reader.
MIFARE Classic 1K: Read-Only Sequence
Readers: ACR1252U, ACR1552U, ACR122U (PICC entry). Card: a new MIFARE Classic 1K card on the factory key. All commands are PC/SC Part 3 storage-card commands, which these ACS readers carry out themselves.
| Test | Command | Expected reply (per ACS/PC/SC documentation; BSD test pending) | Pass if |
|---|---|---|---|
| M1 ATR | None (QuickView) | 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A, the ACS manuals' MIFARE Classic 1K example (card name 00 01). | Card name is 00 01 |
| M2 UID | FF CA 00 00 00 | 4 UID bytes + 90 00 (7 bytes on 7-byte-UID versions of the card). | Ends 90 00; same UID on every run |
| M3 ATS check | FF CA 01 00 00 | An error status word, not an ATS: MIFARE Classic cards have no ATS. The exact error code depends on the reader. | No ATS returned |
| M4 Factory-key read, sector 1 | The five-line sequence in the MIFARE card test guide: load the factory key, authenticate block 04 with key A, read blocks 04 to 06 | 90 00 for the key load and the authentication; 16 data bytes + 90 00 for each block read. | All five replies as documented |
| M5 Repeat after re-tap | Lift the card, place it again, run M2 and M4 again | Same replies as before. Moving the card resets it, so run the whole M4 sequence again, key load included (the key locations are also cleared when the reader is unplugged). | Same UID and data |
Do not read or write the sector trailer (block 07 in sector 1) and do not authenticate with any key other than the factory key. The reasons, and the list of protected blocks, are in the MIFARE guide's safety rules.
NTAG and MIFARE Ultralight: Read-Only Sequence
Readers: ACR1252U, ACR1552U, ACR122U (PICC entry). Card: an NTAG213/215/216 sticker or a MIFARE Ultralight card. These tags need no key: never send a MIFARE Classic key load or authentication to them.
| Test | Command | Expected reply (per ACS/PC/SC documentation; BSD test pending) | Pass if |
|---|---|---|---|
| N1 ATR | None (QuickView) | Storage-card ATR with card name 00 03 (MIFARE Ultralight). The ACS tables have no separate NTAG entry, so which name each reader reports for an NTAG is part of BSD's pending test. | Storage-card ATR, standard byte 03 |
| N2 UID | FF CA 00 00 00 | 7 UID bytes + 90 00. | Ends 90 00, 7 bytes |
| N3 Pages 0 to 3 | FF B0 00 00 10 | 16 bytes (4 pages) + 90 00. Page 3 is the capability container; an NDEF-formatted NTAG21x starts it with E1 (NXP data sheet values are in the NDEF read check). | 16 bytes + 90 00 |
| N4 First user pages | FF B0 00 04 10 | 16 bytes (pages 4 to 7) + 90 00. A new NDEF-formatted tag shows an empty NDEF message (03 00 FE), possibly after another TLV block. | 16 bytes + 90 00 |
| N5 ATS check | FF CA 01 00 00 | An error status word: NTAG and Ultralight have no ATS. | No ATS returned |
Read lengths: the ACR122U and ACR1252U manuals give 16 bytes as the maximum for one Ultralight read, so keep Le = 10. Never write pages 0 to 3 (serial number, lock bytes and the one-time-programmable capability container). Writing NDEF data is a separate task, covered in writing NDEF data to NTAG tags.
MIFARE DESFire: Detection and Version Only
Readers: ACR1252U, ACR1552U, ACR122U (PICC entry). Card: a new MIFARE DESFire card. DESFire data sits behind DES, 3DES or AES keys, so a manual test stops at detection and the GetVersion command, which needs no key. GetVersion goes to the card in the ISO 7816-4 wrapping that ACS documents in the ACR122U API manual; PC/SC Part 3 requires the reader to pass such card APDUs through unchanged.
| Test | Command | Expected reply (per ACS/PC/SC documentation; BSD test pending) | Pass if |
|---|---|---|---|
| D1 ATR | None (QuickView) | A short ISO 14443-4 ATR starting 3B 8n 80 01 with no card name. The ACS manuals give two DESFire examples, 3B 81 80 01 80 80 (ACR1552U) and 3B 86 80 01 06 75 77 81 02 80 00 (ACR122U). | Starts 3B 8n 80 01, no A0 00 00 03 06 |
| D2 UID | FF CA 00 00 00 | 7 UID bytes + 90 00, unless the card has been set to a random ID. | Ends 90 00 |
| D3 ATS | FF CA 01 00 00 | The ATS + 90 00. The ACR1552U manual's example reply is 06 75 77 81 02 80 90 00. | ATS bytes + 90 00 |
| D4 GetVersion, part 1 | 90 60 00 00 00 | 7 bytes + 91 AF (more frames follow). | Ends 91 AF |
| D5 GetVersion, part 2 | 90 AF 00 00 00 | 7 bytes + 91 AF. | Ends 91 AF |
| D6 GetVersion, part 3 | 90 AF 00 00 00 | 14 bytes (they include the UID) + 91 00. | Ends 91 00 |
91 xx status words belong to DESFire, not to ISO 7816-4: 91 AF means "more data", 91 00 means success. Send D5 and D6 straight after D4, with no other command in between. Stop after D6: listing applications, authenticating and reading files need DESFire keys and are not part of a read-only test. The MIFARE guide's DESFire section explains how to read the version bytes and the Windows Plug and Play effect on fresh cards.
SLE4442 and SLE4428 Memory Cards on the ACR39U
Reader: ACR39U (contact). Cards: SLE4442 (256-byte memory) or SLE4428 (1 KB memory). These are memory cards without a processor, so the ACR39U maps their functions onto ACS pseudo-APDUs that start with FF. ACS's ACR39x reference manual says the application must select the card type first, after connecting to the reader with SCardConnect. Use a separate script for each card type: the card-type byte differs.
| Test | Command | Expected reply (per ACS documentation; BSD test pending) | Pass if |
|---|---|---|---|
| S1 Card seen | None (QuickView) | Card insertion and removal shown. What ATR the reader reports for these memory cards before the card type is selected is part of BSD's pending test, so record whatever appears. | Insert and remove both shown |
| S2 Select card type | SLE4442: FF A4 00 00 01 06SLE4428: FF A4 00 00 01 05 | 90 00. The reader powers the card down and up again and resets it. | 90 00 |
| S3 Read the first 32 bytes | FF B0 00 00 20 | SLE4428: 32 data bytes + 90 00. SLE4442: the manual's response layout shows the data bytes followed by four protection-bit bytes, then 90 00; record exactly what comes back. | Ends 90 00, at least 32 bytes |
| S4 Error counter (read only) | SLE4442: FF B1 00 00 04SLE4428: FF B1 00 00 03 | SLE4442: counter + 3 dummy bytes + 90 00; 07 means the last code verification was correct. SLE4428: counter + 2 dummy bytes + 90 00; FF means the last verification was correct. On both, 00 means the code is locked. | Ends 90 00; note the counter value |
| S5 Protection bits (SLE4442 only) | FF B2 00 00 04 | 4 bytes + 90 00: one bit for each of the first 32 bytes; 1 = byte can be written, 0 = write-protected. | 4 bytes + 90 00 |
Never present or change the security code during a test
SLE4442 and SLE4428 cards protect writing with a programmable security code, and every wrong presentation uses up one try from the error counter. When the counter reaches 00, the ACR39x manual says the code is locked. The present-code, change-code and write commands are therefore left out of this plan on purpose. S4 only reads the counter, which is safe. We leave out the SLE4428 protection-bit read too, because the manual's command table and its example use different instruction bytes for it.
If you need to read SLE cards with buttons instead of commands, BSD's ACR39U utility does that: download the BSD ACR39U utility (free after a one-time email check). The reader itself is described on the ACR39U product page.
Expected vs Unexpected Replies
Read every reply from the end. The last two bytes are the status word; the bytes in front of it are data. A test passes only when both match: the documented status word and the documented data length. The meaning of each ISO status word is in the status word table; this table only maps the replies you are likely to see in this plan to a verdict.
| Reply you got | In which tests | Verdict |
|---|---|---|
Documented data length + 90 00 | All except D4 to D6 | Pass. |
90 00 but a different data length (for example 4 UID bytes where you expected 7) | M2, N2, D2, N3/N4, S3 | Unexpected. The card is probably not the type you think: go back to stage 1 and check the ATR. |
91 AF, then 91 00 | D4 to D6 | Pass (DESFire frame chaining). |
63 00 | Any ACS FF command | Fail: ACS manuals use it for "operation failed". On M4, see the failed authentication checks. |
6A 81 | M2, N2, D2 on the wrong entry; any FF command on a model that does not support it | Fail: function not supported. Check the reader entry (PICC, not SAM) and the command against the reader's manual. |
| An error status word | M3, N5 | Pass: a card without an ATS is expected to refuse FF CA 01. |
6E 00 or 6D 00 | D4 to D6 | Fail: the card does not accept the command. Check the card is really a DESFire (D1, D3). |
Any other 6X XX | Any | Fail. Look it up in the status word table; the ACR1552U manual treats any 6X XX as a failure of its own commands. |
| No reply, a PC/SC error code, or "card removed" | Any | Fail below the APDU layer. Note the code and see the failure table. |
When the ACS manual for your reader and this table disagree, the manual wins: status words for FF commands are set by the reader, and they can differ between reader models.
Results Table Template
Fill in one row per command. Write the reply exactly as the tool shows it, including the status word, and decide pass or fail against the expected reply above. Keep the tool's log file with the table; the Script Tool can save it automatically.
Header for each test session: date, tester, reader model and firmware, Windows version (10 or 11, with build), driver version, tool and tool version, card label and card type.
| Test ID | Command sent | Expected reply (documentation) | Actual reply | Pass / fail | Notes |
|---|---|---|---|---|---|
| R1 | None (QuickView) | Reader listed, ATR shown | |||
| M2 | FF CA 00 00 00 | 4 bytes + 90 00 | |||
| N3 | FF B0 00 00 10 | 16 bytes + 90 00 | |||
| D4 | 90 60 00 00 00 | 7 bytes + 91 AF | |||
| S2 | FF A4 00 00 01 06 | 90 00 | |||
| … |
The same template as text, to paste into a spreadsheet (comma-separated):
Date,Tester,Reader,Firmware,Windows,Driver,Tool and version,Card label,Card type,Test ID,Command sent,Expected reply,Actual reply,Pass/Fail,Notes
2026-12-02,initials,ACR1252U,,Windows 11,,ACS Script Tool 5.2,T-01,MIFARE Classic 1K,M2,FF CA 00 00 00,4 bytes + 90 00,,,
Never put a real key or a customer's card data into a shared results file. For a factory-key test, "factory key" is enough.
What to Do with Each Failure
| Failure | Likely cause | Next step |
|---|---|---|
| R1: no reader in the tool | Driver missing, reader not detected, Smart Card service stopped | Reader not detected by Windows, then "No reader found" and service errors. |
| R1: reader listed, no card or no ATR | Card not in the field, wrong card frequency, wrong slot, card inserted the wrong way (ACR39U) | Reader works, but the card is not read. |
| ACR1552U types numbers into Notepad; tools see no card | Keyboard emulation mode, which bypasses PC/SC | Keyboard emulation mode problems. |
| Stage 1: ATR shows a different card type | The test card is not what its label says, or the reader reports an alternate ATR | Relabel the card and run the sequence for the type the ATR shows. Decode it with the ATR guide. |
| M2/N2/D2: UID different on each tap | A random ID card, or more than one card in the field | Wrong UID or a different card number. |
M4: 63 00 at authentication | Key not loaded, wrong block or key type, card moved, or the card is not on the factory key | Work through what a failed authentication means. If the card is not on the factory key, use another test card. |
N3/N4: 63 00 or another error | Wrong length, page outside the tag's memory, or password-protected pages | Keep Le = 10 and start at page 00; see the MIFARE guide's troubleshooting table. |
D4: error instead of 91 AF | Not a DESFire, or Windows Plug and Play changed the card's command mode | Check D1 and D3, then lift the card and present it again (DESFire notes). |
| S2: error on select card type | Wrong card-type byte for the card, card not inserted fully, or the connection was not opened first | Check the card's printed type (SLE4442 = 06, SLE4428 = 05), reinsert it chip-first, reconnect and repeat. |
S4: counter reads 00 | The card's security code is already locked | Stop: the card can no longer be written. Keep it for read tests only and use a new card for anything else. |
PC/SC error such as 0x80100069, 0x8010000B or 0x80100066 | Card removed, sharing violation (another program holds the card), or the card did not respond | Close other card software and look the code up in the PC/SC error code table. |
| Works in one tool, fails in another or in your code | Different bytes, wrong reader entry, or a protocol mismatch | Compare the logged bytes; see the Script Tool problems and Web APDU Tool problems tables. |
Before you ask anyone for help, collect what the troubleshooting centre's checklist lists, and attach your results table and the tool's log.
The Plan as ACS Script Tool Files
Language: ACS Script Tool 5 script (plain text). Prerequisites: Script Tool installed and the right reader chosen (first-script steps), one card on the reader. Each line carries its expected status word in round brackets, so the tool stops at the first unexpected reply. Save each block as its own file and keep Iterations at 1.
Not yet tested on hardware. These files follow the syntax in ACS's Script Tool 5 help file and the commands in the ACS manuals. BSD has not yet run them on its readers; the results will be added here after the test session.
; apdu-test-mifare-classic-1k.txt (read-only; not yet tested on hardware)
; M2: UID, 4 bytes expected on most MIFARE Classic 1K cards
FF CA 00 00 00 (90 00)
; M4: run the factory-key read of sector 1 exactly as shown in
; test-mifare-card-acs-reader.html#mifare-classic, then note the replies.
; apdu-test-ntag.txt (read-only; not yet tested on hardware)
FF CA 00 00 00 (90 00)
FF B0 00 00 10 (90 00)
FF B0 00 04 10 (90 00)
; apdu-test-desfire.txt (read-only; not yet tested on hardware)
FF CA 00 00 00 (90 00)
FF CA 01 00 00 (90 00)
90 60 00 00 00 (91 AF)
90 AF 00 00 00 (91 AF)
90 AF 00 00 00 (91 00)
; apdu-test-sle4442-acr39u.txt (read-only; not yet tested on hardware)
FF A4 00 00 01 06 (90 00)
FF B0 00 00 20 (90 00)
FF B1 00 00 04 (90 00)
FF B2 00 00 04 (90 00)
; apdu-test-sle4428-acr39u.txt (read-only; not yet tested on hardware)
FF A4 00 00 01 05 (90 00)
FF B0 00 00 20 (90 00)
FF B1 00 00 03 (90 00)
Expected result: the Script Tool runs every line without an error prompt, and the Main Logs show each command and its reply. Copy the replies into the results table. M3 and N5 (FF CA 01 00 00 on cards without an ATS) are left out of the files because they are expected to fail; send them by hand if you want to confirm it.
If it fails: the Script Tool shows an error prompt and the line number. Choose Quit Execution, note the reply and use the failure table. Do not choose Ignore All Errors during a test run.
Sources
Commands and expected replies were checked on 30 Nov 2026 in the ACS manuals supplied with ACS SDK kits and listed on the ACS download pages, and in the PC/SC specification. Everything is summarised in our own words. BSD has not yet run this plan on hardware.
- ACS, ACR39x Reference Manual v1.03, section 8 (memory card commands: SELECT_CARD_TYPE, READ_MEMORY_CARD, READ_PRESENTATION_ERROR_COUNTER, READ_PROTECTION_BITS for SLE4418/4428 and SLE4432/4442), listed as "Reference Manual of ACR39 Series Smart Card Reader" on the ACR39U downloads page
- ACS, ACR122U Application Programming Interface v1.4: Get Data, ATR examples, DESFire ISO 7816-4 wrapping and GetVersion frame chaining (section 7.2), from the ACR122U downloads page
- ACS, ACR1552U Series Reference Manual v1.05: ATR generation, Get Data and the ATS example, from the ACR1552U downloads page
- ACS, ACR1252U Application Programming Interface v1.17 (MIFARE Classic and Ultralight read limits), from the ACR1252U downloads page, as cited in BSD's MIFARE test guide
- PC/SC Workgroup specifications, Part 3 rev. 2.01.09: storage-card commands (Get Data, Load Keys, General Authenticate, Read Binary) and the rule that readers pass card APDUs through unchanged
- ACS utility tools page (QuickView, Script Tool, Web APDU Tool), as described in BSD's tool guides
BSD Infotech is an independent ACS supplier and integrator, not the manufacturer. ACS, the ACS logo and ACS product names belong to Advanced Card Systems Ltd. MIFARE, MIFARE Classic, MIFARE Ultralight, MIFARE DESFire and NTAG are trademarks of NXP B.V. SLE is a product designation of Infineon Technologies AG. Windows is a trademark of Microsoft Corporation.
