rnunley
I'm having a bit of trouble getting things working properly on a Raspberry Pi with fully updated Raspbian Jessie and a Arduino Uno as the slave. I can talk serial from when it's attached to my Windows workstation and the loop is executing and parse message fires as expected but when I plug it into the Pi it doesn't appear to ever be found by OpenPLC server. I get the following in the server logs: 

OpenPLC Software running...
Port found: platform-3f980000.usb-usb-0:1.2:1.0
Trying to open /dev/ttyACM0

The port didn't respond properly

Couldn't find any suitable port
Setting main thread priority to RT
Locking main thread memory

Server: Listening on port 502

Server: waiting for new client...


Getting current time

Any ideas on how I to resolve this?


UPDATE: I went spelunking in the source and found the receivePacket() in arduino.cpp method and uncommented the debug output. Below is the server log with the changes: 

OpenPLC Software running...
Port found: platform-3f980000.usb-usb-0:1.5:1.0
Trying to open /dev/ttyACM0

Read 38 bytes
0x53 0x00 0x00 0x00 0x00 0xc0 0x00 0x40 0x01 0x80 0x01 0x80 0x01 0x40 0x01 0xc0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x45

Read 38 bytes
0x53 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x02 0x00 0x02 0x80 0x02 0x40 0x03 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x45

Read 38 bytes
0x53 0x00 0x00 0x00 0x00 0xc0 0x01 0x00 0x02 0x00 0x02 0x40 0x02 0x40 0x03 0x40 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x45

Read 38 bytes
0x53 0x00 0x00 0x00 0x00 0x80 0x00 0x80 0x00 0xc0 0x00 0xc0 0x00 0x40 0x02 0x40 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x45

Read 38 bytes
0x53 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x40 0x00 0x00 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x45

The port didn't respond properly

Couldn't find any suitable port
Setting main thread priority to RT
Locking main thread memory
Server: Listening on port 502
Server: waiting for new client...

Getting current time
Reply 0 0
thiagoralves
That's weird. The data you're receiving from the debug appears to be correct. It must start with 0x53 and end with 0x45. For some reason parseBuffer() is returning false for your data and then OpenPLC is saying that /dev/ttyACM0 is an invalid port. Try changing hardware_layer.cpp line 306

if (parseBuffer(receiveBuffer, response))

with this:

if (true) //(parseBuffer(receiveBuffer, response))
Reply 0 0
rnunley
So, that didn't solve it but I did find a solution. It appears that the custom build of Raspbian I was using for my Adafruit TFT display was the culprit. Not sure why, but installing the generic image did the trick. Thank you. 
Reply 0 0
Reply