[SOLVED] Serial binding problems

Trying to get the serial binding to work with my Marantz AVR, but no luck. I have tested it out using minicom and noticed that to get it to work all flow control has to be off. I don’t know if that is the case with the serial binding and I can’t find any information about it. Also the protocol uses \r to terminate commands, can I just send commands like this or how do I encode that?

sendCommand(Marantz, "@PWR:2\r")

My item looks like this:

String Marantz					"Marantz AVR"		{ serial="/dev/ttyMarantz@9600" }

I’m a complete beginner at openhab2, so I’m not even sure how to enable specific debug for the binding. I’ve tried

log:set DEBUG org.openhab.bindings.serial1

in karaf, but I can’t say I see anything new when checking the log (log:tail)

And my openhab user has permission to use the serial port, I tested it using minicom also and it works fine.

I’m more and more sure the problem is that the device (my AVR) does not use flow control and the serial binding does. Is there any way to turn this off for the binding? Can’t find anything in the source, but might have missed something.

Solved it, it pays off to read the documentation better, I just missed this part:

If you are using non standard serial ports you have to adapt start.sh to have the serial port included. the java command line should then include the following parameters:

-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0

I am also trying to setup the serial binding on openhab2, and I read this line about adding the device to the java command (I have to add /dev/ttyUSB0). However, start.sh doesn’t directly call java - it calls karaf. And karaf is a complex script that at the and calls java somewhere.
Are you using openhab2 also? Where exactly did you add the -D definition? I even tried adding it to setenv in the JAVA_OPTS section, but without success. It doesn’t even get me an error message…

Ah, you only have to add a line like this in the start.sh file:

export EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0"

but as I understood it, you should not have to add ports with normal names
like ttyUSB0, could be permission problems as well. Check with ls -al in
the /dev folder who owns your port and add your user to the same group if
needed. I’m not 100% sure about when the option is needed a not, but good
luck! :slight_smile:

Thank you @mattias_mansson! This is a valuable information. I will try it this way, hoping that I at least get a debugger message, be it an error or a success :slight_smile:

Oops… I guess I am a step further, or back. Now the JVM crashes when I activate the item containing { serial="/dev/ttyUSB0@57600" }
A real crash with a java core dump, and in which regularly appears …/openhab2/userdata/tmp/libNRJavaSerial_openhab2_0/libNRJavaSerial.so
It seems that my JVM has a problem with the Serial binding. Any idea how I could proceed to find the reason?

Has anybody an idea on how to research the origin of a crash with a binding when the TRACE debug doesn’t deliver any message? Can I put the source code (just of the binding) somewhere, compile it and then go down to the problem? If yes, where would I have to install the source and the class?

Have no idea unfortunately, hope someone else can help you… :frowning: