AdvancedHMI Software
General Category => Open Discussion => Topic started by: bachphi on January 17, 2017, 04:37:47 PM
-
is there a solution to the Pi USB-Serial?. My app is very simple , just the serial driver with a basic label. I verified it works with PC, but not with Pi
1. I verified that USB-serial adapter is attached to /dev/ttyUSB0 with dmesg
pi@raspberrypi:~ $ dmesg | grep FTDI
[ 2.115733] usb 1-1.4: Manufacturer: FTDI
[ 5.043141] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 5.043434] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
[ 5.044668] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
2. use Godra's mono GetSerial showed that it is /dev/ttyUSB0:
pi@raspberrypi:~ $ mono getserial.exe
/dev/ttyUSB0
3. Tried set access permission:
sudo chmod 777 /dev/ttyUSB0
4. Tried set logical link with:
sudo ln -s /dev/ttyUSB0 COM1
5. Also tried adding this:
sudo nano /etc/modules // use lsusb to see product id & vendor
sudo modprobe usbserial vendor=0x0403 product=0x6001
-
Archie's reply #66 in other topic would suggest that there is no solution currently:
http://advancedhmi.com/forum/index.php?PHPSESSID=99891631c91bbc594fa6e3823662f2b5&topic=666.msg8053#msg8053
Vitor's experiment does show that it works with ethernet, as you already know that:
http://advancedhmi.com/forum/index.php?PHPSESSID=99891631c91bbc594fa6e3823662f2b5&topic=899.0
-
http://www.benchforge.com/downloads/colt/colt_users_manual_02.pdf
The above link seemed to indicated that mono serial is possible , I think.
Vitor's experiment seemed to require an additional PC.
Is it possible to first use Serial2net and set it to port 44818 instead, then in AAHMI, use driver like EthernetIPforSLCMicroCom1 or SerialDf1overTcpForSLCMicroCom1?
-
If you do have a Pi then you can always experiment with different options until you find one that works (your question might be your answer as well).
I currently don't have a Pi or a Linux computer to try anything.
-
Somehow, I knew you gonna say that, Godra. :=)
I am not even sure how to use the new driver SerialDf1overTcpForSLCMicroCom, wonder if Archie has a minute to explain this further
-
I have some small success today. I am using version 399t.
Using ser2net , set its configuration to:
44818:raw:600:/dev/ttyUSB0:38400 8DATABITS NONE 1STOPBIT
In my AAHMI solution, I have one BasicLabel which pull a 1000ms (1 sec) value timer from ML1000.
I set SerialDf1overTcpForSLCMicroCom1 driver to have IP address: 127.0.0.1 and pollrate to 1000.
When I started the app, basiclabel would display timer.acc value then stuck there for a while, meanwhile, I can see that TRX, RCV lights are going off/on. After a while, then values would changer per pollrate and lights are on/off evenly. It would run for a while ( few minutes) then crash.
Archie, do you have any suggestion here? see attached logfile
-
I experienced the same behavior while using driver SerialDf1overTcpForSLCMicroCom1 & even though I ran it on PC.
That is value would come up, froze, then display per pollrate , eventually crashed.
or If I try to manually write to a bit, worked a few times then crashed with error "No Response from PLC during Write"
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
-
Have you tried doing a test with the PLC attached directly to the PC (via USB2RS232 adapter if you are using it)?
-
Yes, that was the first thing before I started to the Pi, using SerialDF1forSLC driver . Worked
Also tried
RaspberryPi ( Ser2net) <----> PC [ SerialToIPGUI as client, Com0Com, AAHMI with SerialDF1forSLC driver]. Worked very good.
and
RaspberryPi ( mono SerialToIP as server) <----> PC [ SerialToIPGUI as client, Com0Com, AAHMI with SerialDF1forSLC driver]. Worked amazingly stable.
I believed there is some bug in the SerialDf1overTcpForSLCMicroCom1 driver. It is a recently released driver.
-
You can also try SerialDf1overTcpForSLCMicroCom1 without the Pi by using AHMI and SerialToIP server.
The setup should be similar to this:
AHMI with SerialDf1overTcpForSLCMicroCom1 set to 127.0.0.1 and either 44818 or 8282 port
SerialToIP server set to use either 44818 or 8282 port and USB2RS232 COM port
In a setup like this, the SerialToIP server should be frequently disconnecting/re-connecting and create a lag (but should still be working).
-
I believed I tried that as well, but I will verify it on Monday.
1. Pi ( ser2net, mono AAHMI with SerialDf1overTcpForSLC ) . ==> not reliable, crashed as described in previous post.
2. Pi ( ser2net ) <------> PC ( AAHMI with SerialDf1overTcpForSLC) ==> not reliable, crashed
3. Pi ( mono serialtoip server ) <------> PC ( AAHMI with SerialDf1overTcpForSLC) ==> not reliable, crashed.
4. PC ( SerialToIPGUI server, AAHMI with SerialDf1overTcpForSLC ) will verify on Mon.
I just did some update & check mono version. it show version 4.6.2 (Stable 4.6.2.16/ac9e222 Tue Jan 3 12:12:14 UTC 2017), I am hoping it will do some good for me :=)
-
You could also try 1 more thing:
Run AHMI under mono on the Pi itself, with SerialDf1overTcpForSLCMicroCom1 set to 127.0.0.1 and 8282 port if you use SerialToIPGUI server or 44818 port if you are to use ser2net on the other end (meaning as the receiver for the packets).
-
Do you mean like case #1?
-
Yes, like that ... which leaves only SerialToIP server to try then.
This driver is more of experimental driver and I'm not sure if Archie would be looking to make any improvements to it.
-
4. PC ( SerialToIPGUI server, AAHMI with SerialDf1overTcpForSLC ) ==> BasicLabel display value, froze, then crashed. it certainly crashed immediately when writing a bit to PLC while it's disconnected.
-
Archie,
Since all my experiments have failed, I found the SerialPortLib driver that claims to overcome the lack of DataReceived event in Mono. https://github.com/genielabs/serialport-lib-dotnet/ (https://github.com/genielabs/serialport-lib-dotnet/)
I wonder if it's possible to use the SerialPortLib driver, get the data in and pass it on to SerialDF1forSLCMicroCom1 driver.
Below is the codes I have. Thank You.
Imports SerialPortLib
Private Shared _serialPort As SerialPortLib.SerialPortInput
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
_serialPort = New SerialPortInput()
AddHandler _serialPort.ConnectionStatusChanged AddressOf SerialPortLib_ConnectionStatusChanged
AddHandler _serialPort.MessageReceived AddressOf SerialPortLib_MessageReceived
_serialPort.SetPort("/dev/ttyUSB0", 38400)
_serialPort.Connect()
End Sub
Private Shared Sub SerialPortLib_MessageReceived(sender As Object, args As MessageReceivedEventArgs)
Console.WriteLine("Received message: {0}", BitConverter.ToString(args.Data))
_serialPort.SendMessage(New Byte() {&H6}) 'send an ACK message back
End Sub
Private Shared Sub SerialPortLib_ConnectionStatusChanged(sender As Object, args As ConnectionStatusChangedEventArgs)
Console.WriteLine("Serial port connection status = {0}", args.Connected)
End Sub
-
Are there any news on this topic?
-
I currently have a device in the testing phase that is essentially an Ethernet to Serial gateway that uses a special AdvancedHMI driver. If this all proves out to be stable, I hope to have these available for purchase from the main web site for around $50. An alternative is an ENI module from Allen Bradley.
-
Or you can get one of these:
http://www.rtaautomation.com/product/515rtaeni/
I have not used this particualr model, but some other ASCII to Ethernet/IP gateways, and they are pretty good! Really easy to configure (web server), they are cheaper than AB, and they have more capacity and features. Really a no brainer.
-
I think there may be a solution for this now, from here: http://advancedhmi.com/forum/index.php?topic=1744.0
(http://advancedhmi.com/forum/index.php?topic=1744.0)
So theoretically speaking, install DF1 daemon on the pi, this will taking care of serial communication, then run Mono AHMI with loopback