cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect STM32U5 ( B-U585IOT02A ) using mqtt to Local mqtt Broker

radeshsharma
Associate II

Hello Community,

I want to connect my STM32U5 ( B-U585IOT02A ) using mqtt to local broker which is running on ubuntu system.

I found one example running mqtt in STM32U5 ( B-U585IOT02A ).

STM32CubeU5/Projects/B-U585I-IOT02A/Applications/NetXDuo/Nx_MQTT_Client at main · STMicroelectronics/STM32CubeU5 · GitHub

But this example demonstration runs mqtt with tls and test broker test.mosquitto.com But in my case I just want to share sensors data using mqtt to mqtt broker running in ubuntu system over same wifi network.

Can Anyone can tell me where should I do changes in the example to achieve connection to local broker.

Thanks in advance for you valuable answer.

2 REPLIES 2
CMYL
ST Employee

Hello,

I will share your request with colleague if someone can help, let you know when I have feedbacks.

Best Regards,

Younes

MSG_ST
ST Employee

Hello,

In order to connect to your local MQTT broker, you have some changes to make :

  • Remove Security :
  1. Replace nxd_mqtt_client_secure_connect function by nxd_mqtt_client_connect and make the corresponding changes.
  2. Define MQTT_PORT NXD_MQTT_PORT (1883) instead of NXD_MQTT_TLS_PORT (8883)
  • Replace MQTT_BROKER_NAME by your local Broker IP address.
  • Assign your local Broker IP to the mqtt_server_ip.nxd_ip_address.v4 variable.
  • Remove DNS process.

Regards

Mahdy