Skip to main content
Visitor II
June 10, 2022
Solved

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

  • June 10, 2022
  • 2 replies
  • 1976 views

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.

    This topic has been closed for replies.
    Best answer by MSG_ST

    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

    2 replies

    Technical Moderator
    August 11, 2022

    Hello,

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

    Best Regards,

    Younes

    MSG_STAnswer
    ST Employee
    October 21, 2022

    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