Command Reference

Complete listing of all opcodes in the Command IntEnum. Located in pepper_c1/commands.py. Import with from pepper_c1.commands import Command.

Commands with a ✓ in the Wrapped column have a dedicated convenience method in PepperC1. Others can be called via send_command().

General Commands (0x00–0x0C)

ConstantOpcodeWrappedDescription
ACK0x00—Response first byte: command succeeded.
DUMMY0x01No-op ping command.
GET_TAG_COUNT0x02✓ get_tag_countReturn number of tags in RF field.
GET_UID0x03✓ get_uidReturn UID info for a tag by index.
ACTIVATE_TAG0x04✓ activate_tagActivate (select) a tag for subsequent operations.
HALT0x05✓ haltHalt the active tag.
SET_POLLING0x06✓ set_pollingEnable/disable automatic tag polling with interval.
SET_KEY0x07✓ set_keyStore a cryptographic key in a reader slot.
SAVE_KEYS0x08✓ save_keysPersist loaded keys to non-volatile memory.
SET_NET_CFG0x09Configure network (TCP) settings.
REBOOT0x0A✓ rebootReboot the reader module.
GET_VERSION0x0B✓ get_versionReturn firmware version string.
UART_PASSTHRU0x0CPass raw data through to UART (diagnostic use).

MIFARE Classic (0x20–0x27)

ConstantOpcodeWrappedDescription
MF_READ_BLOCK0x20✓ mf_read_blockRead one or more 16-byte blocks.
MF_WRITE_BLOCK0x21✓ mf_write_blockWrite one or more 16-byte blocks.
MF_READ_VALUE0x22✓ mf_read_valueRead a value block (signed 32-bit integer).
MF_WRITE_VALUE0x23✓ mf_write_valueInitialise a value block.
MF_INCREMENT0x24✓ mf_incrementIncrement a value block and transfer result.
MF_TRANSFER0x25Transfer the internal transfer buffer to a block.
MF_RESTORE0x26Copy a value block to the transfer buffer.
MF_TRANSFER_RESTORE0x27Combined restore + transfer operation.

MIFARE Ultralight (0x40–0x4A)

ConstantOpcodeWrappedDescription
MFU_READ_PAGE0x40✓ mfu_read_pageRead one or more 4-byte pages.
MFU_WRITE_PAGE0x41✓ mfu_write_pageWrite one or more 4-byte pages.
MFU_GET_VERSION0x42Read EV1 hardware/software version (7 bytes). Use send_command().
MFU_READ_SIG0x43Read NXP originality signature (EV1 only). Use send_command().
MFU_WRITE_SIG0x44Write originality signature (special use).
MFU_LOCK_SIG0x45Lock the originality signature permanently.
MFU_READ_COUNTER0x46✓ mfu_read_counterRead a 3-byte NFC counter value.
MFU_INCREMENT_COUNTER0x47✓ mfu_increment_counterIncrement an NFC counter.
MFU_PASSWD_AUTH0x48✓ mfu_passwd_authAuthenticate with 4-byte password.
MFUC_AUTHENTICATE0x493DES authentication for Ultralight-C.
MFU_CHECKEVENT0x4ACheck for Ultralight event (device-specific).

MIFARE DESFire (0x60–0x7C)

ConstantOpcodeWrappedDescription
MFDF_GET_VERSION0x60✓ mfdf_card_versionGet 28-byte hardware/software version from card.
MFDF_SELECT_APP0x61✓ mfdf_select_appSelect application by 3-byte AID.
MFDF_APP_IDS0x62✓ mfdf_get_app_idsList all AIDs on the card.
MFDF_FILE_IDS0x63List file IDs in the selected application.
MFDF_AUTH0x64✓ mfdf_authDES/3DES authentication.
MFDF_AUTH_ISO0x65ISO/IEC 7816 authentication (3DES).
MFDF_AUTH_AES0x66✓ mfdf_auth_aesAES-128 authentication.
MFDF_CREATE_APP0x67✓ mfdf_create_appCreate a new application.
MFDF_DELETE_APP0x68✓ mfdf_delete_appDelete an application and all its files.
MFDF_CHANGE_KEY0x69Change a cryptographic key.
MFDF_GET_KEY_SETTINGS0x6ARead key settings for the selected app.
MFDF_CHANGE_KEY_SETTINGS0x6BChange key settings for the selected app.
MFDF_CREATE_DATA_FILE0x6C✓ mfdf_create_data_fileCreate standard or backup data file.
MFDF_WRITE_DATA0x6D✓ mfdf_write_dataWrite to a data file.
MFDF_READ_DATA0x6E✓ mfdf_read_dataRead from a data file.
MFDF_CREATE_VALUE_FILE0x6F✓ mfdf_create_value_fileCreate a value file with limits.
MFDF_GET_VALUE0x70✓ mfdf_get_valueRead current value from a value file.
MFDF_CREDIT0x71✓ mfdf_creditAdd to a value file (requires commit).
MFDF_LIMITED_CREDIT0x72Limited credit operation (restricted amount).
MFDF_DEBIT0x73✓ mfdf_debitSubtract from a value file (requires commit).
MFDF_CREATE_RECORD_FILE0x74✓ mfdf_create_record_fileCreate a linear or cyclic record file.
MFDF_WRITE_RECORD0x75✓ mfdf_write_recordAppend a record (requires commit).
MFDF_READ_RECORD0x76✓ mfdf_read_recordRead records from a record file.
MFDF_CLEAR_RECORDS0x77✓ mfdf_clear_recordsDelete all records from a file (requires commit).
MFDF_DELETE_FILE0x78✓ mfdf_delete_fileDelete a file from the selected app.
MFDF_GET_FREEMEM0x79✓ mfdf_get_free_memReturn free memory in bytes.
MFDF_FORMAT0x7A✓ mfdf_formatErase all apps and files (factory reset).
MFDF_COMMIT_TRANSACTION0x7B✓ mfdf_commit_transactionCommit pending write operations.
MFDF_ABORT_TRANSACTION0x7C✓ mfdf_abort_transactionDiscard pending write operations.

ICODE ISO 15693 (0x90–0xBF)

ConstantOpcodeWrappedDescription
ICODE_INVENTORY_START0x90✓ icode_inventory_startStart inventory, return first tag UID.
ICODE_INVENTORY_NEXT0x91Continue inventory to find next tag.
ICODE_STAY_QUIET0x92Put tag into quiet state (stops responding to inventory).
ICODE_READ_BLOCK0x93✓ icode_read_blockRead one or more 4-byte blocks.
ICODE_WRITE_BLOCK0x94✓ icode_write_blockWrite one or more 4-byte blocks.
ICODE_LOCK_BLOCK0x95Permanently lock a block against further writes.
ICODE_WRITE_AFI0x96Write Application Family Identifier (AFI).
ICODE_LOCK_AFI0x97Lock the AFI field permanently.
ICODE_WRITE_DSFID0x98Write Data Storage Format Identifier (DSFID).
ICODE_LOCK_DSFID0x99Lock the DSFID field permanently.
ICODE_GET_SYSTEM_INFORMATION0x9A✓ icode_get_system_informationRead system information (UID, block size, count, AFI, DSFID).
ICODE_GET_MULTIPLE_BSS0x9BGet multiple block security status (lock bits).
ICODE_PASSWORD_PROTECT_AFI0x9CEnable password protection for AFI (NXP extension).
ICODE_READ_EPC0x9DRead EPC data (SLIX2 / DNA).
ICODE_GET_NXP_SYSTEM_INFORMATION0x9ERead NXP-specific system information.
ICODE_GET_RANDOM_NUMBER0x9FGet random number from tag (used for password auth).
ICODE_SET_PASSWORD0xA0Set a password on the tag.
ICODE_WRITE_PASSWORD0xA1Write a new password value.
ICODE_LOCK_PASSWORD0xA2Lock the password field.
ICODE_PROTECT_PAGE0xA3Enable page-level protection (SLIX2).
ICODE_LOCK_PAGE_PROTECTION0xA4Lock page protection settings.
ICODE_GET_MULTIPLE_BPS0xA5Get multiple block protection status.
ICODE_DESTROY0xA6Permanently destroy the tag (irreversible).
ICODE_ENABLE_PRIVACY0xA7Enable privacy mode (tag stops responding until unlocked).
ICODE_ENABLE_64BIT_PASSWORD0xA8Enable 64-bit password mode.
ICODE_READ_SIGNATURE0xA9Read NXP originality signature.
ICODE_READ_CONFIG0xAARead configuration pages (SLIX2 / DNA).
ICODE_WRITE_CONFIG0xABWrite configuration pages.
ICODE_PICK_RANDOM_ID0xACGenerate a random ID (SLIX2 privacy mode).
ICODE_SET_EAS0xADEnable Electronic Article Surveillance (EAS).
ICODE_RESET_EAS0xAEDisable EAS.
ICODE_LOCK_EAS0xAFLock EAS state permanently.
ICODE_EAS_ALARM0xB0Trigger EAS alarm scan.
ICODE_PASSWORD_PROTECT_EAS0xB1Password-protect EAS commands.
ICODE_WRITE_EASID0xB2Write EAS identifier (barcode-like data).
ICODE_CUSTOM_CMD0xBFSend a custom/vendor-specific ICODE command.

Device Filesystem (0xE0–0xE3)

ConstantOpcodeDescription
FOPEN0xE0Open a device file. Payload: mode byte (0 = read, 1 = write) followed by the file name, without a terminating NUL.
FREAD0xE1Read the next part of the open file. An ACK with no data means end of file.
FWRITE0xE2Append up to 128 bytes to the open file.
FCLOSE0xE3Close the open file.

Special (0xFE–0xFF)

ConstantOpcodeDescription
ASYNC0xFEAsynchronous event from reader (e.g. tag detected/removed during polling). Payload stored in PepperC1.async_events.
ERROR0xFFCommand failed. Causes CommandError to be raised with the failing command byte and error code.

Key Type Constants

Defined at module level in pepper_c1/commands.py. Pass to set_key() as the key_type argument.

ConstantValueAlgorithmKey size
KEY_TYPE_AES1280x00AES-12816 bytes
KEY_TYPE_AES1920x01AES-19224 bytes
KEY_TYPE_AES2560x02AES-25632 bytes
KEY_TYPE_DES0x03Single DES8 bytes (padded to 16 for DESFire)
KEY_TYPE_2K3DES0x042-key Triple DES16 bytes
KEY_TYPE_3K3DES0x053-key Triple DES24 bytes
KEY_TYPE_MIFARE0x06MIFARE Classic key12 bytes (key A 6B + key B 6B)
from pepper_c1.commands import KEY_TYPE_MIFARE, KEY_TYPE_AES128, KEY_TYPE_DES

reader.set_key(0, KEY_TYPE_MIFARE,  bytes([0xFF] * 12))  # Classic, FFFFFFFFFFFF both A+B
reader.set_key(1, KEY_TYPE_AES128, bytes(16))            # AES-128 all-zeros
reader.set_key(2, KEY_TYPE_DES,    bytes(16))            # DES all-zeros (PICC master default)