Skip to main content

MT25C serial commands reference

MT25C is operated via a virtual serial interface (USB CDC‑ACM). Users may control the device either with the provided GUI or directly through this documented protocol.

TIP

This document provides a reference for the most basic way to communicate with the MT25C. To get started quickly, we recommend using the provided MT25C-Term GUI application, which allows you to easily generate packets and test them on a connected MT25C device. The GUI also provides a convenient way to visualize the results of your commands.

Packet format​

HeaderSize (LSB, MSB)CommandPayloadCRC (LSB, MSB)
0x55byte‑count of Command + Payload + CRC1 byteN bytes2 bytes

Every command sent by the host is acknowledged by the MT25C with the same command code and a zero‑length payload.

CRC‑16‑CCITT calculation​

All packets include a 16‑bit CRC calculated over the Command byte and the Payload bytes only (header 0x55 and size field are excluded).

ParameterValue
Polynomial0x1021
Init value0xFFFF
ReflectionNone
Final XORNone
POLY = 0x1021
INIT = 0xFFFF

def crc16_ccitt(data: bytes) -> int:
crc = INIT
for b in data:
crc ^= b << 8
for _ in range(8):
crc = ((crc << 1) ^ POLY) if (crc & 0x8000) else (crc << 1)
crc &= 0xFFFF
return crc

Pin states​

ContextStateValueDescription
Static measurementLED‑A0x01LED anode
LED‑C0x02LED cathode
LED‑AC0x03Bidirectional LED
SHORT0x04Short circuit
COM0x05Common pin
Mechanical buttonBUT00x10Button released
BUT10x11Button pressed
Capacitive buttonTCH00x20Touch released
TCH10x21Touch pressed

Serial command list​

Request ID​

Command name: ID

Command code: 0x00

Description: Sent by the host to identify the connected MT25C. The device replies with the ASCII string "MT25C" (0x4D 0x54 0x32 0x35 0x43).

Payload size: 0

Example frame: 55 00 03 00 E1 F0


Load configuration​

Command name: CFG

Command code: 0x01

Description: Configure operating parameters.

Payload size: 3   • Byte 1 – Maximum contact resistance (Ω, 0‑255)   • Byte 2 – Capacitive threshold (0‑128)   • Byte 3 – Buzzer volume (0‑100)

Example frame: (contact resistance: 50 Ω, capacitive threshold: 32, volume: 100) 55 00 06 01 32 20 64 73 75


Set insertion detection mode​

Command name: DETECT_INSERT

Command code: 0x02

Description: Puts the MT25C in keypad‑insertion detection mode.

Payload size: 0

Example frame: 55 00 03 02 C1 B2


Keypad inserted event (device → host)​

Command name: ON_INSERT

Command code: 0x03

Description: Emitted when a keypad is detected.

Payload size: 0

Example frame: 55 00 03 03 D1 93


Request static measurement​

Command name: MES_STATIC

Command code: 0x04

Description: Launch a static measurement (LEDs, shorts, opens).

Payload size: 0

Example frame: 55 00 03 04 A1 74


Static measurement event (device → host)​

Command name: ON_STATIC_MES

Command code: 0x05

Description: Returns N measurement pairs. Each pair is 6 bytes: Pin1, State1, Pin2, State2, Vdrop12, Vdrop21 (20 mV/LSB).

Payload size: 6 × N

Example frame: (one pair 1‑2) 55 00 09 05 01 01 02 02 05 07 6B 82


Request mechanical button scan​

Command name: MES_BUTTON_MECH

Command code: 0x06

Description: Enables mechanical button scanning; events are reported with ON_BUTTON_MECH.

Payload size: 0

Example frame: 55 00 03 06 81 36


Mechanical button event (device → host)​

Command name: ON_BUTTON_MECH

Command code: 0x07

Description: Indicates a mechanical button press/release.

Payload size: 6

Example frame: (button 1‑2 pressed) 55 00 09 07 01 10 02 11 00 00 30 4B


Request capacitive button scan​

Command name: MES_BUTTON_CAP

Command code: 0x08

Description: Enables capacitive button scanning; events are reported with ON_BUTTON_CAP.

Payload size: 0

Example frame: 55 00 03 08 60 F8


Capacitive button event (device → host)​

Command name: ON_BUTTON_CAP

Command code: 0x09

Description: Indicates a capacitive pad touch/release.

Payload size: 4

Example frame: (pad 1‑2 touched) 55 00 07 09 01 20 02 21 1B 23


Set removal detection mode​

Command name: DETECT_REMOVE

Command code: 0x0A

Description: Puts the MT25C in keypad‑removal detection mode.

Payload size: 0

Example frame: 55 00 03 0A 40 BA


Keypad removal event (device → host)​

Command name: ON_REMOVE

Command code: 0x0B

Description: Emitted when a keypad is removed.

Payload size: 0

Example frame: 55 00 03 0B 50 9B