3

I'm building a linux-based cashless device and trying to achieve communication with VMC in vending machines over UART directly without needing additional hardware adapter to convert between 8-bit and 9-bit frame data.

I'm only using the cashless device, no intention to connect any other peripheral to the VMC.

I read questions asked about this before, some of them stressed on the need to an adapter, others suggested possible hacks to achieve the 9-bit to 8-bit conversion, but still can't find a confirmed working and stable solution.

My question is, Is it possible (and reliable) to achieve this using a pure software solution? and how?

Thanks

David Sidarous
  • 1,202
  • 1
  • 10
  • 25
  • Well, if you can dedicate a CPU core to this, you can always use bit banging to support MDB in pure software. It's less power-efficient than a hardware solution, and you may need to go lower level if Python appears unable to give you acceptable performance, but it's still possible. – Ruslan May 27 '19 at 09:42

1 Answers1

1

Yes.

The 9th bit is a control bit. It will show if the data is to be interpreted as an address or as data. If you are communicating with one device and sending only data you want to strip the 9th bit out and only look at data frames. Check and see if it's always zero:

If controlBit = 0:
    ProcessData(byte)
Else:
    print("This is an address: " + byte)

EDIT: Many people have reported that your connection will not be stable without special hardware due to timing problems.

Instead of reinventing the wheel you can use opensource code as a starting point. https://github.com/mhaqs/vendiverse/wiki/Programming-the-VMC

This way you don't have to make the same mistakes over and over again.

HackSlash
  • 4,944
  • 2
  • 18
  • 44
  • This looks ok for receiving but what about sending ? How this can be achieved ? – David Sidarous May 31 '19 at 12:21
  • Use an existing open source project as a starting point. Look at the Vendiverse link I posted. There you can see a working implementation of what you are trying to do. Otherwise you will be writing the transmit protocol from scratch. Why would you do that? – HackSlash May 31 '19 at 15:19
  • Here is someone that has code for bit banging UART in C, the discussion about timing will be important for you: https://electronics.stackexchange.com/questions/66605/bit-banging-uart – HackSlash May 31 '19 at 15:29