arduinoserial-communicationusartmultidrop-bus

Issue regarding TX line of Arduino while communicating with Vending machine via MDB Protocol over USART


I am trying to communicate with a Vending machine using MDB Protocol with the help of Arduino Mega and I am partially successful in doing so.

The circuit that I am using is attached here

Breadboard Layout of Circuit

While the circuit diagram is shown below

Circuit Diagram

The Arduino Mega is communicating with laptop via Serial 1 and the vending machine communication is done via Serial 2 of Arduino Mega.
USART is being use for communication.

The strange issue that I am facing is, the communication with the vending machine starts sending data only when brown colored wires A and B are initially not connected(which are connecting Arduino TX to Vending Machine RX). Once I see the data coming from Vending Machine, I short wires A and B and Arduino Starts sending data to the vending machine too.
But if Wires A and B are connected on the start of a vending machine, the vending machine doesn't send any data to Arduino and hence no communication takes place. I want to make it work without manually connecting wire A and B every time.


I have tried replacing Optocoupler PC817C with

I tried replacing Hex Inverter with

I tried putting a mechanical and then solid-state relay between wires A and B and tried connecting them via external input but nothing happens
I tired adding an optocoupler as a switch between wires A and B and tried controlling it via firmware.

I even tried replacing the hex inverter with hex buffer HCF4050BE and a NOT Gate but regardless of any combination of mentioned components the issue remains the same, it only works if Wires A and B are initially not connected and then shorted once data starts coming from the vending machine.

I am using MateDealer's code.
I want to automate this manual process and need a simple solution for that.


Solution

  • Resolved

    The issue was due to a missed state machine element. My Device is a LEVEL-1 MDB Device and the vending machine that I am using requires the slave devices(whether they are at LEVEL-1 or LEVEL-2) to even respond to LEVEL-2 SETUP poll which is not a standard case in MDB Specifications Document.

    Why it was working when TX wire was de-attached?

    My logic analyzer was displaying some random hex values when TX line was removed and that random stuff caused the device to work.
    By responding to the extra setup configuration poll of my vending machine I was able to make it work smoothly.
    Below is the picture showing the configuration data sent by VMC which was discarded by my device making it behave strangely.

    enter image description here