hos2

[Solved] Help: Beckhoff profibus master FC3121 with Siemens CP342-5

10 posts in this topic

Dose anyone have experience with Beckhoff FC3121 profibus master PCIe card connected to Siemens CP342-5 as a profibus slave?

The data retrieved from S7 PLC is wrong, and keeps fluctuating rapidly.
TwinCAT (TC) config looks OK, and it reports that the slave is OK and has no error.
The slave is in Run mode with green LEDs.
S7 side is believed to be OK as another master from HMS-Anybus retrieved the data correctly.
Tried several versions of TC up to the latest (at the moment) ver. 2.11.2305.


Here is a zip file with two graph pics of the two masters showing how the "same" data looks like in each case:
https://drive.google.com/file/d/1ijlx6AXA3FX8GqgJjwWlFMxPxqT4xN9F/view?usp=sharing

Thanks,
Hos

Edited by hos2
problem fixed

Share this post


Link to post
Share on other sites

More than likely. the high and low endian are swapped.  Most Profibus interface cards allow you to configure the card to automatically handle the byte swapping.  If not then you'll need to write code to swap the bytes after receiving them and before writing them to the Siemens slave. 

Share this post


Link to post
Share on other sites
19 hours ago, pcmccartney1 said:

More than likely. the high and low endian are swapped.  Most Profibus interface cards allow you to configure the card to automatically handle the byte swapping.  If not then you'll need to write code to swap the bytes after receiving them and before writing them to the Siemens slave. 

The card has this function. The master only receives data from the slaves and doesn't write to them. May be I didn't clearly emphasize enough that the main problem is the wide fluctuation of the received values even though in he PLC, they are either stable (setpoints) or change within a narrow range (readbacks).

What makes it looks related to Beckhoff master side is (as I wrote), a different master receives the same data correctly.

Share this post


Link to post
Share on other sites

Is it also a Beckhoff master?

Share this post


Link to post
Share on other sites
Just now, pcmccartney1 said:

Is it also a Beckhoff master?

It's mentioned in the original post:

" another master from HMS-Anybus retrieved the data correctly "

Share this post


Link to post
Share on other sites

seems loike you need to check the configuration of the working device and find the configuration error in the second device.

Share this post


Link to post
Share on other sites

As the two masters from different makers, with different config software, the comparison is not straight forward.

Share this post


Link to post
Share on other sites

I took a look at your data trend pictures.  Looks to me that your bad one is inverted.  I again ask you to look at the configuration of the Beckhoff FC3121.  See if there is a means to do byte swapping.  Siemens has the low and high endian bytes swapped versus most any other PLC platform.

From a mapping or tag assignment viewpoint, any chance you are off by one byte?

Is it possible the configuration is looking for signed intergers versus unsigned integers and thus inverting the signal.

If there is no chance to fix it in the module, then you are going to have to write a lot of code to swap the bytes to see the correct data.

Edited by pcmccartney1

Share this post


Link to post
Share on other sites

It seems like it has a relation with byte swapping like you wrote.

Hold on, I'm waiting for detail from the field for a possible fix.

Share this post


Link to post
Share on other sites

[Solved]
I owe you a deep and sincere apology.

Let me try to make the story short:
From the beginning, due to security reasons, I wasn't allowed to access the PLCs (which are several thousand miles away) remotely.
I was allowed only remote access to the PC in which TwinCAT is running.
Any modification I would need to do with any of the PLCs, I had to send it to a person in the field to apply it, then I would investigate the results in TC.

Due to the erroneous data received by TC, I suggested modifying one of the PLCs to send known-fixed values, hoping that I can locate these values in the PFB card memory (suspecting wrong or shifted addresses).
After getting the OK that the modification was implemented, TC was still showing erroneous values... Here I posted my original msg.
With the lack of new ideas, I insisted on accessing the PLCs myself...Finally, I got the OK.

Just a few minutes after access, I found that my modification was wrongly applied: instead of copying blocks from one project to another, they edited the existing blocks with code from the original blocks (not the modified ones). So, I was under a "wrong" impression that the values are fixed in the PLC while they are changing in TC.
After correcting this mistake, TC shows the known-fixed values as they are but bytes-reversed.
Applying "byte-swapping" function (thanks for pointing this out), TC and the linked software show the data correctly. 

Please accept my apology and I'm really thankful for your help.
Hos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now