ZeroHeroDXD

TLS session establishment fail

9 posts in this topic

I've been working on a final year project for my school and part of my task is to connect the plc to azure to read and write using the Azure IoTHub as a MQTT broker. I havent been able to find alot of information on this topic but I've found enough to get started but now im running into the 200C error which states that the TLS session establishment has failed. I have set my tlsconfig with the symmetric key setting and the image shows the other variables with the rung. I havent been able to find a fix for this or anyone talking about it so I would really appreciate the help.

Screenshot 2022-12-06 092115.png

Share this post


Link to post
Share on other sites

Omron has an MQTT library of Function blocks.  I would recommend that you use them.  

You can download the library here:

https://www.ia.omron.com/product/tool/sysmac-library/index.html

Your software does need to be registered to login.  

I have also attached a document describing the process and some sample code. It shows how to do it using Mosquitto, but you should be able to go from there.  

 

MQTT Sysmac Controllers and Mosquitto POC.pdf

MQTT NX102 and NJ301.smc2

1 person likes this

Share this post


Link to post
Share on other sites

I've already downloaded the MQTT library prior and used the function blocks to connect to other brokers online. But because I need to use the MQTT block to connect to azure IoTHub it requires me to create a TLSSession which is where I'm currently getting the error of not being able to establish it.

Share this post


Link to post
Share on other sites
17 hours ago, ZeroHeroDXD said:

I've already downloaded the MQTT library prior and used the function blocks to connect to other brokers online. But because I need to use the MQTT block to connect to azure IoTHub it requires me to create a TLSSession which is where I'm currently getting the error of not being able to establish it.

The MQTT library that supports TLS is only compatible with NX PLCs (NX102 & NX1P2) >= firmware 1.46

I'm trying to track it down now...

Edited by photovoltaic
1 person likes this

Share this post


Link to post
Share on other sites

Thank you so much!!!! It finally works, I was just missing some variables that you listed which I didn't think were needed. I really appreciate the time taken out of your schedule to help me out!!

Share this post


Link to post
Share on other sites

Ok this is weird now its connected but the session says it isnt present, when I ping it tells me its not connected and when i try to send something it cancels the connection. Error code when I publish is 200F for the MQTTClient block

 

 

Screenshot 2022-12-08 165334.png

Edited by ZeroHeroDXD

Share this post


Link to post
Share on other sites

Try a timeout of UINT#1000. 10ms for a ping across the WAN is unlikely.

 

Capture.PNG

Share this post


Link to post
Share on other sites

Changed that and a couple other things and I'm now receiving the messages. Again thank you so much haha

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