AdvancedHMI Software
General Category => Support Questions => Topic started by: joseph_e2 on June 10, 2020, 03:17:06 PM
-
I've spent a lot of time working with Siemens and Allen-Bradley PLCs, but I recently changed jobs to a facility with a number of Beckhoff Twincat systems. Some are v2, others are 3. The one I'm working on now is Twincat 2. I want to be able to read tags out of the machine onto a PC for logging. It's been a long time, but I've done this before with Advanced HMI and an AB processor. I remember recently testing communications again and it "just worked" on the first try with little trouble, but I can't get the Beckhoff system to talk to me. Here's what we're running:
Machine information:
Windows XP Embedded
Beckhoff TwinCAT version 2.11.1553
PLC Control Version 2.11.0 Build 1016
This is an industrial PC mounted inside the machine cabinet and connected to a touch screen monitor on a swing arm. The PC is also running the OEM's custom HMI software.
IP Address: 192.168.0.20
Advanced HMI information:
Windows 7 x64 virtual machine (no extra firewall, virus scanner, or weird network security software on it) with a dedicated USB Ethernet adapter to bypass any IT issues on the host. The USB Ethernet adapter is attached to the VM as a device so it's invisible to the host.
Advanced HMI v3.99x in Visual Studio 2015
IP address: 192.168.0.50
The usb ethernet adapter attached to the VM is patched directly to the Beckhoff PC's NIC. The Beckhoff PC replies to ping from the VM.
I added a TwinCATCom driver and a panel meter to the main form.
I went into the PC and found a global variable to read. I have screenshots showing what I've done so far. What am I doing wrong?
-
Is TwinCAT installed on the PC you are running AdvancedHMI on? If so, it will not let it work. The TwnCAT AMS router intercepts packets destined for AdvancedHMI and will not let them through.
-
TwinCAT is not installed on the AdvancedHMI PC. It's a clean Windows 7 install with Visual Studio.
Weird...I don't remember hitting the "Post" button, and the original post still shows up in edit mode on the laptop I was using for this yesterday.
Let me summarize the settings I've looked at on the TwinCAT PC:
In the TwinCAT System Properties dialog box, System tab.
TwinCAT Server list box:
TcCam
Tclo
TcNc
TcPlc
TcRTime
Auto Boot is Enabled with Auto Logon checked. User Name is Administrator, Password is blank.
Same dialog box, AMS Router tab, AMS Net Id: 192.168.20.1.1 (I changed this from the previous setting of 127.255.255.1.1.1
I logged out of Windows and back in to verify that the login name is Administrator and its password is also blank.
Inside the PLC control, I found a list of global variables and chose a few at random to try to reach, ending up with "RunCnt" which looks like something we want to read anyway.
-
I just realized that I never described the problem. The solution builds and tests without any warnings, but the panel meter almost immediately shows error 999, no value returned by driver.
I tried it again as a test with the network definitely not connected at all and there are no messages at all, the digital panel meter just sits there displaying "0" with no errors. The output window shows a bunch of lines like this:
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
When I get the "no value returned by driver" error, the output window shows a bunch of lines like this:
Exception thrown: 'MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException' in MfgControl.AdvancedHMI.Drivers.dll
-
The best way to see what is happening is to run a Wireshark capture. You will see the request using a certain port number. The response must come back on that same port. if not, then TwinCAT is rerouting the packets.
-
Sorry for the delayed response. I'm tied up this week and out of the office next week, so I'll try Wireshark when I get back. I'll let you know what I find out. Or if I need help, since I'm not a Wireshark expert...
-
It's been a crazy time, but I finally got back out to the machine after downloading and installing Wireshark. I'm...not sure what I'm looking at. There are UDP packets going back and forth. I've attached a screenshot showing what's going on.
It looks like the replies are returning to the same port.
Where should I look for further details?
-
Can you save the file and post it ?
-
Here it is.
-
Does the Administrator account on the TwinCAT PC have a password?
For remote connections, Windows requires a password.
-
You mean the Windows Administrator account? I can check. As long as it will still auto logon with the password, that shouldn't be a problem.
-
Yes, the Windows Administrator account. You can still use Auto Login, but it just needs a password
-
I added a password ("1") to the Administrator user account in Windows on the TwinCAT PC and tested the autologin to make sure I didn't break it. I also added that password to the "System" tab of the "TwinCAT System Properties" dialog box and to the properties of the COM object in the AHMI project. Here is an updated Wireshark capture.
Thanks!
-
Here are some screenshots.
-
I can see that AdvancedHMI is trying to add a route to the TwinCAT routing table. It must be failing because it keeps trying. I will have to try to find the details of the response to see if I can figure out which bytes are the error codes.
If you check the Router table on the TwinCAT machine, does it show an AdvancedHMI???? route?
-
The list box on the AMS Router tab is always empty, but I don't know if I've ever looked at it while AHMI was running...
I'll try to test that tomorrow.
-
As I've thought about it further, it occurs to me that the OEM who build the machine may have locked something down. When we asked about remote connections for data, they sent us a brochure and a quote for their custom software package. It was NOT cheap. It wouldn't surprise me if something they've done is breaking things
-
The first thing AdvancedHMI does it create route entries in both the target and local machines. If you have UseStaticRoute set to True, it creates a permanent route entry.
I don't know of anyway to block it unless there is a firewall turned on blocking remote access to the TwinCAT port number. You can try to temporarily turn off all firewalls to see if that is the problem.
-
I looked up the error code which was bytes 28 and 29 of the data packet. In your WireShark the error is 0x0704 which according the ADS error code table:
https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_system/99079192176427915.html&id=
The error is:
ADSERR_DEVICE_INVALIDACCESS
Reading or writing not permitted.
This is vague to me, so I am not sure why
-
As an experiment, I made a copy of an old WinXP virtual machine and installed TwinCat2 on it. It came with a sample PLC program, which I got to run by following a tutorial on Beckhoff's website. I then pointed my VS project at the new XP VM and got it to display a blinking light based on one of the variables inside the Beckhoff software. I also found a static route called AdvancedHMI8BE1 in the system control dialog box and in the system manager under System - configuration -> Route settings.
The only trouble I had was that there was a second host-only network adapter on the virtual machine. While that was there, Wireshark was showing traffic on the second adapter and AHMI wouldn't work. Once I deleted the second host-only adapter, AHMI started working. Is there a trick on the Beckhoff side when there are multiple NICs? The Beckhoff PC I'm trying to connect to has 2 NICs. I'm using one of them for these tests but it'll ultimately have to talk through the other that's connected to our wired LAN.
I also asked the OEM if there is a setting on their end that's blocking it. Hopefully there is and they're willing to tell me how to un-block it without paying them for their (very expensive) software.
It looks like the AHMI side is configured properly and that there's something wonky inside the Beckhoff PC.
-
I heard back from the machine OEM. They asked... "May I know the communication format from your AdvancedHMI to our beckhoff? OBCUA?"
-
ADS/AMS
https://infosys.beckhoff.com/english.php?content=../content/1033/tcadsamsspec/html/tcadsamsspec_intro.htm