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)
| Constant | Opcode | Wrapped | Description |
|---|---|---|---|
| ACK | 0x00 | — | Response first byte: command succeeded. |
| DUMMY | 0x01 | No-op ping command. | |
| GET_TAG_COUNT | 0x02 | ✓ get_tag_count | Return number of tags in RF field. |
| GET_UID | 0x03 | ✓ get_uid | Return UID info for a tag by index. |
| ACTIVATE_TAG | 0x04 | ✓ activate_tag | Activate (select) a tag for subsequent operations. |
| HALT | 0x05 | ✓ halt | Halt the active tag. |
| SET_POLLING | 0x06 | ✓ set_polling | Enable/disable automatic tag polling with interval. |
| SET_KEY | 0x07 | ✓ set_key | Store a cryptographic key in a reader slot. |
| SAVE_KEYS | 0x08 | ✓ save_keys | Persist loaded keys to non-volatile memory. |
| SET_NET_CFG | 0x09 | Configure network (TCP) settings. | |
| REBOOT | 0x0A | ✓ reboot | Reboot the reader module. |
| GET_VERSION | 0x0B | ✓ get_version | Return firmware version string. |
| UART_PASSTHRU | 0x0C | Pass raw data through to UART (diagnostic use). |
MIFARE Classic (0x20–0x27)
| Constant | Opcode | Wrapped | Description |
|---|---|---|---|
| MF_READ_BLOCK | 0x20 | ✓ mf_read_block | Read one or more 16-byte blocks. |
| MF_WRITE_BLOCK | 0x21 | ✓ mf_write_block | Write one or more 16-byte blocks. |
| MF_READ_VALUE | 0x22 | ✓ mf_read_value | Read a value block (signed 32-bit integer). |
| MF_WRITE_VALUE | 0x23 | ✓ mf_write_value | Initialise a value block. |
| MF_INCREMENT | 0x24 | ✓ mf_increment | Increment a value block and transfer result. |
| MF_TRANSFER | 0x25 | Transfer the internal transfer buffer to a block. | |
| MF_RESTORE | 0x26 | Copy a value block to the transfer buffer. | |
| MF_TRANSFER_RESTORE | 0x27 | Combined restore + transfer operation. |
MIFARE Ultralight (0x40–0x4A)
| Constant | Opcode | Wrapped | Description |
|---|---|---|---|
| MFU_READ_PAGE | 0x40 | ✓ mfu_read_page | Read one or more 4-byte pages. |
| MFU_WRITE_PAGE | 0x41 | ✓ mfu_write_page | Write one or more 4-byte pages. |
| MFU_GET_VERSION | 0x42 | Read EV1 hardware/software version (7 bytes). Use send_command(). | |
| MFU_READ_SIG | 0x43 | Read NXP originality signature (EV1 only). Use send_command(). | |
| MFU_WRITE_SIG | 0x44 | Write originality signature (special use). | |
| MFU_LOCK_SIG | 0x45 | Lock the originality signature permanently. | |
| MFU_READ_COUNTER | 0x46 | ✓ mfu_read_counter | Read a 3-byte NFC counter value. |
| MFU_INCREMENT_COUNTER | 0x47 | ✓ mfu_increment_counter | Increment an NFC counter. |
| MFU_PASSWD_AUTH | 0x48 | ✓ mfu_passwd_auth | Authenticate with 4-byte password. |
| MFUC_AUTHENTICATE | 0x49 | 3DES authentication for Ultralight-C. | |
| MFU_CHECKEVENT | 0x4A | Check for Ultralight event (device-specific). |
MIFARE DESFire (0x60–0x7C)
| Constant | Opcode | Wrapped | Description |
|---|---|---|---|
| MFDF_GET_VERSION | 0x60 | ✓ mfdf_card_version | Get 28-byte hardware/software version from card. |
| MFDF_SELECT_APP | 0x61 | ✓ mfdf_select_app | Select application by 3-byte AID. |
| MFDF_APP_IDS | 0x62 | ✓ mfdf_get_app_ids | List all AIDs on the card. |
| MFDF_FILE_IDS | 0x63 | List file IDs in the selected application. | |
| MFDF_AUTH | 0x64 | ✓ mfdf_auth | DES/3DES authentication. |
| MFDF_AUTH_ISO | 0x65 | ISO/IEC 7816 authentication (3DES). | |
| MFDF_AUTH_AES | 0x66 | ✓ mfdf_auth_aes | AES-128 authentication. |
| MFDF_CREATE_APP | 0x67 | ✓ mfdf_create_app | Create a new application. |
| MFDF_DELETE_APP | 0x68 | ✓ mfdf_delete_app | Delete an application and all its files. |
| MFDF_CHANGE_KEY | 0x69 | Change a cryptographic key. | |
| MFDF_GET_KEY_SETTINGS | 0x6A | Read key settings for the selected app. | |
| MFDF_CHANGE_KEY_SETTINGS | 0x6B | Change key settings for the selected app. | |
| MFDF_CREATE_DATA_FILE | 0x6C | ✓ mfdf_create_data_file | Create standard or backup data file. |
| MFDF_WRITE_DATA | 0x6D | ✓ mfdf_write_data | Write to a data file. |
| MFDF_READ_DATA | 0x6E | ✓ mfdf_read_data | Read from a data file. |
| MFDF_CREATE_VALUE_FILE | 0x6F | ✓ mfdf_create_value_file | Create a value file with limits. |
| MFDF_GET_VALUE | 0x70 | ✓ mfdf_get_value | Read current value from a value file. |
| MFDF_CREDIT | 0x71 | ✓ mfdf_credit | Add to a value file (requires commit). |
| MFDF_LIMITED_CREDIT | 0x72 | Limited credit operation (restricted amount). | |
| MFDF_DEBIT | 0x73 | ✓ mfdf_debit | Subtract from a value file (requires commit). |
| MFDF_CREATE_RECORD_FILE | 0x74 | ✓ mfdf_create_record_file | Create a linear or cyclic record file. |
| MFDF_WRITE_RECORD | 0x75 | ✓ mfdf_write_record | Append a record (requires commit). |
| MFDF_READ_RECORD | 0x76 | ✓ mfdf_read_record | Read records from a record file. |
| MFDF_CLEAR_RECORDS | 0x77 | ✓ mfdf_clear_records | Delete all records from a file (requires commit). |
| MFDF_DELETE_FILE | 0x78 | ✓ mfdf_delete_file | Delete a file from the selected app. |
| MFDF_GET_FREEMEM | 0x79 | ✓ mfdf_get_free_mem | Return free memory in bytes. |
| MFDF_FORMAT | 0x7A | ✓ mfdf_format | Erase all apps and files (factory reset). |
| MFDF_COMMIT_TRANSACTION | 0x7B | ✓ mfdf_commit_transaction | Commit pending write operations. |
| MFDF_ABORT_TRANSACTION | 0x7C | ✓ mfdf_abort_transaction | Discard pending write operations. |
ICODE ISO 15693 (0x90–0xBF)
| Constant | Opcode | Wrapped | Description |
|---|---|---|---|
| ICODE_INVENTORY_START | 0x90 | ✓ icode_inventory_start | Start inventory, return first tag UID. |
| ICODE_INVENTORY_NEXT | 0x91 | Continue inventory to find next tag. | |
| ICODE_STAY_QUIET | 0x92 | Put tag into quiet state (stops responding to inventory). | |
| ICODE_READ_BLOCK | 0x93 | ✓ icode_read_block | Read one or more 4-byte blocks. |
| ICODE_WRITE_BLOCK | 0x94 | ✓ icode_write_block | Write one or more 4-byte blocks. |
| ICODE_LOCK_BLOCK | 0x95 | Permanently lock a block against further writes. | |
| ICODE_WRITE_AFI | 0x96 | Write Application Family Identifier (AFI). | |
| ICODE_LOCK_AFI | 0x97 | Lock the AFI field permanently. | |
| ICODE_WRITE_DSFID | 0x98 | Write Data Storage Format Identifier (DSFID). | |
| ICODE_LOCK_DSFID | 0x99 | Lock the DSFID field permanently. | |
| ICODE_GET_SYSTEM_INFORMATION | 0x9A | ✓ icode_get_system_information | Read system information (UID, block size, count, AFI, DSFID). |
| ICODE_GET_MULTIPLE_BSS | 0x9B | Get multiple block security status (lock bits). | |
| ICODE_PASSWORD_PROTECT_AFI | 0x9C | Enable password protection for AFI (NXP extension). | |
| ICODE_READ_EPC | 0x9D | Read EPC data (SLIX2 / DNA). | |
| ICODE_GET_NXP_SYSTEM_INFORMATION | 0x9E | Read NXP-specific system information. | |
| ICODE_GET_RANDOM_NUMBER | 0x9F | Get random number from tag (used for password auth). | |
| ICODE_SET_PASSWORD | 0xA0 | Set a password on the tag. | |
| ICODE_WRITE_PASSWORD | 0xA1 | Write a new password value. | |
| ICODE_LOCK_PASSWORD | 0xA2 | Lock the password field. | |
| ICODE_PROTECT_PAGE | 0xA3 | Enable page-level protection (SLIX2). | |
| ICODE_LOCK_PAGE_PROTECTION | 0xA4 | Lock page protection settings. | |
| ICODE_GET_MULTIPLE_BPS | 0xA5 | Get multiple block protection status. | |
| ICODE_DESTROY | 0xA6 | Permanently destroy the tag (irreversible). | |
| ICODE_ENABLE_PRIVACY | 0xA7 | Enable privacy mode (tag stops responding until unlocked). | |
| ICODE_ENABLE_64BIT_PASSWORD | 0xA8 | Enable 64-bit password mode. | |
| ICODE_READ_SIGNATURE | 0xA9 | Read NXP originality signature. | |
| ICODE_READ_CONFIG | 0xAA | Read configuration pages (SLIX2 / DNA). | |
| ICODE_WRITE_CONFIG | 0xAB | Write configuration pages. | |
| ICODE_PICK_RANDOM_ID | 0xAC | Generate a random ID (SLIX2 privacy mode). | |
| ICODE_SET_EAS | 0xAD | Enable Electronic Article Surveillance (EAS). | |
| ICODE_RESET_EAS | 0xAE | Disable EAS. | |
| ICODE_LOCK_EAS | 0xAF | Lock EAS state permanently. | |
| ICODE_EAS_ALARM | 0xB0 | Trigger EAS alarm scan. | |
| ICODE_PASSWORD_PROTECT_EAS | 0xB1 | Password-protect EAS commands. | |
| ICODE_WRITE_EASID | 0xB2 | Write EAS identifier (barcode-like data). | |
| ICODE_CUSTOM_CMD | 0xBF | Send a custom/vendor-specific ICODE command. |
Special (0xFE–0xFF)
| Constant | Opcode | Description |
|---|---|---|
| ASYNC | 0xFE | Asynchronous event from reader (e.g. tag detected/removed during polling). Payload stored in PepperC1.async_events. |
| ERROR | 0xFF | Command 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.
| Constant | Value | Algorithm | Key size |
|---|---|---|---|
| KEY_TYPE_AES128 | 0x00 | AES-128 | 16 bytes |
| KEY_TYPE_AES192 | 0x01 | AES-192 | 24 bytes |
| KEY_TYPE_AES256 | 0x02 | AES-256 | 32 bytes |
| KEY_TYPE_DES | 0x03 | Single DES | 8 bytes (padded to 16 for DESFire) |
| KEY_TYPE_2K3DES | 0x04 | 2-key Triple DES | 16 bytes |
| KEY_TYPE_3K3DES | 0x05 | 3-key Triple DES | 24 bytes |
| KEY_TYPE_MIFARE | 0x06 | MIFARE Classic key | 12 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)