Arduino pro micro (Leonardo) + MDB

Hello. I try to connect Arduino pro micro to coffemashine by MDB like cashless device. MDB use 9 bits and Arduino pro micro have hardware 9bits port. then I connect Arduino pro micro TX/RX () - MDB RX/TX

create test sketch:


byte EXT_UART_BUFFER[37]; //входящий буфер для полученной команды от VMC
int EXT_UART_BUFFER_COUNT;

byte EXT_ChecksumValidate() {
  byte sum = 0;
  for (int i=0; i < (EXT_UART_BUFFER_COUNT-1); i++)
    sum += EXT_UART_BUFFER[i];
  if (EXT_UART_BUFFER[EXT_UART_BUFFER_COUNT-1] == (sum & 0xFF))
    return 1;
  else
    return 0;
}

void setup() {
  // put your setup code here, to run once:

   Serial.begin(115200);
   Serial1.begin(9600);
   Serial1.setTimeout(100);

}

void loop() {
  // put your main code here, to run repeatedly:

    EXT_UART_BUFFER_COUNT = 0; //ставим размер буфера 0
  while (Serial1.available()) {
    //записываем все данные с порта в приемный буфер
    EXT_UART_BUFFER[EXT_UART_BUFFER_COUNT++]=Serial1.read(); //и за одно получаем размер этой команды
    delay(20); //задержка а то команда не успевает приняться целиком 
  } 

if (EXT_UART_BUFFER_COUNT > 0) {

Serial.print("Recvd CMD: "); 
  for (int a = 0; a < EXT_UART_BUFFER_COUNT; a++){
    if (EXT_UART_BUFFER[a] < 16) Serial.print("0");
    Serial.print(EXT_UART_BUFFER[a], HEX); 
    }

    Serial.println("");
  
}

}

and get:

Recvd CMD: 1A0010
Recvd CMD: 00
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 071606
Recvd CMD: 0716061206120612061206120612061206120612061206
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F
Recvd CMD: 1B160F070F070F0F070F070F070F06120E06120E06120E06120E
Recvd CMD: 0B1B050D1903070F1206070F1206070F120606060E070F1206
Recvd CMD: 0B1B050D1903070F1206070F1206070F120606070F12060B1B

but, it's not a request to connection device... If anyone work with MDB please help - what's wrong? Thanks!

what does it mean?

pls provide schematic of MDB and wiring diagram of connections between both devices

it's mean that MDB send to Serial port 9bits, not 8 as standard UART

let me guess, your board is this
зображення

no, this one:

it is clone of "SparkFun Pro Micro". this chip has only 1 UART and it is already used for USB connection

UPD: i was wrong. UART pins 0/1 are not used for USB connectivity.

this refers to the same hardware UART port and here is nothing about mentioned 9 bit.
where do you read that "MDB" using 9 bit frame?

The devices communicate in a single-master, multiple-slave configuration using the MDB protocol, which is based on a Motorola[specify] 9-bit UART implemented as an 8-bit data value with an additional mode bit. 

It use ATmega32U4

https://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf

Nonsense. The 32U4 has native USB support that is used for communication over USB with the PC. The UART (on pins 0 and 1) is not involved in the communication with the PC.

@juffin, I can't help you further.

where you got this strange picture?
check this out:

There are many options, but "9-bit" data is not listed --
Serial.begin() - Arduino Reference

config: sets data, parity, and stop bits. Valid values are:
SERIAL_5N1
SERIAL_6N1
SERIAL_7N1
SERIAL_8N1 (the default)
SERIAL_5N2
SERIAL_6N2
SERIAL_7N2
SERIAL_8N2
SERIAL_5E1: even parity
SERIAL_6E1
SERIAL_7E1
SERIAL_8E1
SERIAL_5E2
SERIAL_6E2
SERIAL_7E2
SERIAL_8E2
SERIAL_5O1: odd parity
SERIAL_6O1
SERIAL_7O1
SERIAL_8O1
SERIAL_5O2
SERIAL_6O2
SERIAL_7O2
SERIAL_8O2

If MDB uses 9-bit communication you will need a library that enabled the 9-bit feature of the UART hardware. The Arduino library does not include 9-bit support. There may even be someone who had made an MDB library. Try google.