Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect with mosquitto (CPU313C and CP343-1 Lean) #8

Open
GerritMeu opened this issue Oct 14, 2022 · 3 comments
Open

Can't connect with mosquitto (CPU313C and CP343-1 Lean) #8

GerritMeu opened this issue Oct 14, 2022 · 3 comments

Comments

@GerritMeu
Copy link

GerritMeu commented Oct 14, 2022

Hi, I'm using the hardware that has been used in the test of the maker.

Unfortunately, it does not connect. What can I do possibly wrong?

The IP-Address of the internal adapter has to be configured within the hardware configuration tool (HW Config), click on the PN-IO object
IP address is 192.168.0.1 of the CP module with subnet 255.255.255.0
The connection must be configured in Simatic Manager "Connections"
Has been made, see attachment
you must set the MQTT Functionblock parameter connectionID to the connection ID configured in Simatic Manager "Connections"
What is the connection ID? I used now the backplane connection, see attachment
you must set the MQTT Functionblock parameter cpLADDR to the address of the CP module. Example for a MQTT FB call in OB1 configured for external Ethernet (CP)usage: MQTT.DB71(net_config := DB_NET_CONFIG, connectionID := 1, cpLADDR := W#16#100);
I compiled the example and changed connectionID to 3 (because it is the backplane connection MPI address, is that correct?). I kept cpLADDR the same, because start address is 256 and that 16#100

Did I do something wrong?

Connections
StartAddress
MPIaddressAsConnectionID

@RoanBrand
Copy link
Owner

Hi, I unfortunately do not have much of an answer for you, sorry.
I started this ages ago before there was much regarding MQTT when it came to PLCs.
And I myself haven't worked with them in a while.

I saw a while ago there has been later development on MQTT client libraries for Siemens.
Maybe I can refer you to this after a quick search: https://cache.industry.siemens.com/dl/files/872/109748872/att_1006438/v4/109748872_MQTT_Client_DOKU_V2-1_en.pdf

That said, just after I started this @CarstenMaul did a lot of refactoring and changes.
Maybe he can help with this specific question/problem.

@Jansen1443
Copy link

Hi GerritMeu,

Was curious if it had still worked out. We have several s7-300 and s7-400 and would like to connect them to MQTT as well. I just can't manage to get RoanBrand's example into step7 v5.6. Can you help me with this?

Greetings and thanks in advance.

@GerritMeu
Copy link
Author

GerritMeu commented Jan 5, 2023

Hi GerritMeu,

Was curious if it had still worked out. We have several s7-300 and s7-400 and would like to connect them to MQTT as well. I just can't manage to get RoanBrand's example into step7 v5.6. Can you help me with this?

Greetings and thanks in advance.

Hi Jansen1443,

It worked, but because I had a lack of trust that it complies with the MQTT v3.1.1 specification, I use Node-RED now. Also for the Sparkplug B implementation. I had help @ the Siemens forum to get it going: https://support.industry.siemens.com/forum/ww/en/posts/mqtt-protocol-with-cpu314c-2dp-and-cpu315-2dp/289286/?page=0&pageSize=10

I added my project wherein it worked, you can see the result also in the forum that I shared. In the project, I also added a VAT table wherein you can connect, disconnect etc.

Good luck!

Uns_mqtt_sparkplugb_17OCT22.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants