UPDATE BINARY instruction

The UPDATE BINARY instruction writes data into a memory card (wired-logic PICC or VICC).

For any PICC/VICC but Mifare Classic, this instruction is executed without any prerequisite.For Mifare Classic, to be able to read the sector’s data, the application must be authenticated onthe card’s sector. Your application must always invoke GENERAL AUTHENTICATE instruction (witha valid key A or key B for the sector) before invoking the UPDATE BINARY instruction. Using the MIFARE CLASSIC WRITE instruction instead can be easier and may shorten thetransaction time

Command format

Field Value Remark
P1 AddressMSB See below
P2 AddressLSB See below
DataIn Data
Le absent

P1 and P2 form the address that will be sent to the PICC/VICC in its specific write command. Most PICC/VICC are divided into small blocks (sometimes called pages). The address is a block number, and not to an absolute byte offset in memory.Both the allowed range for the address and the value for Lc depend on the capabilities of the PICC.Please always refer to its datasheet for details.

For Mifare Classic, P1,P2 is the address of the block (0000 to 00FF), but remember that theauthentication is made on a per-sector basis. A new authentication must be performed every timeyou have to access another sector. Lc must be 10 (a block is 16 Bytes long). For a NFC Type 2 Tag, P2 is the block number, and P1 the sector number if the PICC does supportthis feature. Set P1 to 00 if it is not the case. Lc must be 04 (a block is 4 Bytes long).


Field Value Remark
DataOut The expected data
SW 9000 on success Other values are documented in Status Words

Important disclaimer

Most PICC/VICC have specific areas:

  • that can be written only once (OTP: one time programming or fuse bits),
  • and/or that must be written carefully because they are involved in the security scheme of thechip (lock bits),
  • and/or because writing an invalid value will make the card unusable (sector trailer of a MifareClassic for instance).

Before invoking UPDATE BINARY, always double check where you’re writing, and for the sensitive addresses, what you’re writing!