1
votes

I am using this library for communicating with serial ports from Java. Also I am using USB to Serial converter to connect to the device. Here is the documentation that is related to the device :

2.1 Physical Interface The required physical interface between the host and the VGM is the EIA-232 interface.

2.2 Logical Interface The serial data link shall operate at the speed of 19,200 bits per second (BPS), with one start bit, eight data bits, a wake-up bit and one stop bit. The wake-up bit should be set in the first byte of the message; the wake-up bit should be cleared for the remainder of the message. The VGM shall clear the wake-up bit when responding to the host.

I am a little puzzled how to setup the rs232 library settings when connecting to the serial port. There are baud settings, data length in bits (5, 6, 7, 8), stop bits (1, 2) and parity setting. When I mess with these settings I of course get different output (most of the time looking like trash). Can you help me guess the settings with regards to the quoted documentation?

1
From that specification, the easy solution would be to use a USART that is capable of a 9-bit data frame, to accommodate the wake-up bit. Here's some 9-bit serial port shopping advice. Otherwise you would need to use a data length of 8 bits plus parity, and configure the parity to mark for the first byte and then reconfig to space for the remaining bytes. The parity bit (with 8-bit data) would occupy the same bit position in the frame as the wake-up bit.sawdust
@sawdust Hmm, I played with the settings and with 8bit data, 19.2kbit boud, 1 stop bit and parity set to even I think I am getting something . For example when I load array of bytes in Java with this settings, if I split each byte to 2 bytes by using top 4 and bottom 4 bits for each new byte I think I get proper message as intended by the docs. I have to play with it a little more on Monday. Does it sounds plausible to you?Saša Šijak
No. Splitting each byte into nibbles is wrong and unnecessary. You may have trouble in Java trying to reconfig the parity bit.sawdust
@ElGavilan : your edit broke the link. You don't deserve +2 for that.sawdust

1 Answers

1
votes

From what I understand your protocol requires an additional 9th data bit which is used in some exotic applications like Multidrop bus (see also Stackoverflow 14212660). In your case this 9th bit is called "wake-up bit", but you will not find such a thing or name in your java library or and standard RS232 application.

There is a workaround using standard USB to Serial converters. It is exactly what in Stackoverflow 14212660 is called

and no fudging by using the parity bit as a 9th data bit

So, unless you want to buy specialized hardware - I suggest the 'fudging':

Using the parity settings MARK and SPACE should correspond to your desired setting "wake up bit set", resp. "wake up bit cleared". Our software Docklight Scripting allows you in the free evaluation already to do this kind of temporary parity switching, but I assume there are also other tools or code examples around. MDB / multidrop bus should be good Google keywords for this.