MDB Communication Protocal

Introduction

This manual describes the serial communication protocol between Q3 Pos and MDB Interface Board, which will be short as “MIB” in follow content.

The basic baud rate of serial port is set as 115200

As the Q3 POS could be receive command from MIB as a slave, and also could send command to MIB as a master (e.g., send “begin session” command to inform the MDB VMC it’s ready for pay), a mode byte was added in serial frame to show if a command is slave response or a master request.

The request command always anticipates a response command except the checksum is wrong, or the incorrect serial format, in another word, the slave will use silence as a NAK. Please refer to the documentation for specific commands and details.

Serial Protocol Packet Definition

Serial Port Parameters

  • Baud rate: 115200

  • Data format: 8 bits, 1 stop bit, no parity

Packet Format

  • Start code: size 1 byte, always be 0x09

  • Length: size 1 byte, the number bytes of mode, data, and checksum.

  • Mode: size 1 byte, 0x00 means a master request packet, 0x01 means a slave response packet, other value is prohibited.

  • Data: size n bytes, The data could be raw MDB commands, such as SETUP, VEND. Or the MIB control commands, such as GET VERSION, SET PARAMETER.

  • Checksum: size 1 byte, using LRC algorithm, input data were "mode, data"

  • End code: size 1 byte, always be 0x0D.

Specifics

MDB Forwarding Mechanism

When the MIB receive the VMC request, it removes the MDB mode bit, fill into serial packet data area, and transmit to serial port. In the opposite direction, the MIB receive the response, it unwraps the packet, and adding mode bit to the tail bytes, sending to the VMC, wait for the acknowledge.MIB will forward all the MDB cashless device commands (MDB spec section 7), except VMC request Poll.

Example: RESET

  1. VMC -> MIB: 0x110 0x10

  2. MIB -> Q3V: 0x09 0x04 0x00 0x10 0x10 0xE0 0x0D

  3. Q3V -> MIB: 0x09 0x04 0x01 0x00 0x00 0xFF 0x0D

  4. MIB -> VMC: 0x00 0x100

  5. VMC -> MIB : 0x00

Application Notes

  • Focus on steps 2 and 3 in the MDB Forwarding Mechanism.

  • The application handles all cashless commands except POLL.

  • The cashless reader initiates a begin session command to notify the VMC when ready for a transaction.

  • MDB raw data includes its checksum byte, distinct from the serial frame checksum.

A Typical MDB Transaction Flow

Protocol Command Definition

Please refer to the documentation for specific commands and details.

Common MDB Forwarding Command

This command forwards raw MDB commands (including MDB CHK), with the MDB mode bit removed.

Request Packet:

ModeData

Request 00H

VMC Request Command

(Reset,Setup,Reader,Expansion,Vend)

Response Packet:

ModeData

Response 01H

Peripheral Response

Example: MIB -> Q3V 09 04 00 10 10 E0 0D

Q3V -> MIB 09 04 01 00 00 FF 0D.

Begin Session Command

When the application is ready for a transaction, it issues a begin session command to inform the VMC master. This marks the beginning of a transaction. Balance amount is 2 bytes; if balance does not exist, fill with 0xFF. This command follows MDB spec definition but is initiated by the app.

Request Packet:

ModeData

Request 00H

Begin Session (03H) + Funds Available + MDB Checksum

Response Packet:

ModeData

Response 01H

ACK 00H

Example: Q3V -> MIB 09 06 00 03 00 64 67 32 0d

MIB -> Q3V 09 03 01 00 ff 0d

Session Cancel Request(0x04)

The application can end a payment session by issuing a session cancel request command. The POS acts as the master during this command.

Request Packet:

ModeData

Request 00H

Cancel Session Req(04H) + Funds Available + Checksum

Response Packet:

ModeData

Response 01H

ACK 00H

Demo

Source Code for Terminal App

APK

PC Simulation Testing Guide

There're two types of MDB RS232 box, please confirm which one are you testing:

Testing Guide for blue MDB232 box

Testing Guide for black MDB-RS232 box

Last updated