Skip to main content
tarzan2
Associate III
July 24, 2025
Question

MQTT : mqtt_client_connect() don't set user and password !

  • July 24, 2025
  • 2 replies
  • 500 views

Hello,

After loosing days trying to implement paho mqtt with lwip and freeRTOS on a nucleo-F207ZG, I restarted from scratch and try do implement it in bare-metal mode.

After a few hour of debug, using wireshark and mosquitto on a PC :

- Connecting to the broker as anonymous works

- Connecting to the broker with user/pwd fails.

Wireshark shows that there is no user/pwd on the CONNECT packet and the associated flags are reset.

The official mqtt_client_connect() looks quite strange : it does not take care of the eventual user/pwd provided in argument (mqtt_connect_client_info_t *client_info)

Flags are set to MQTT_CONNECT_FLAG_CLEAN_SESSION, and user/pwd are never used by this function.

 

Is the provided MQTT file is just a demo file with limited functionalities ?

Thank you

Regards

 

2 replies

Graduate
July 25, 2025

Hello tarzan2,

I've experienced issues with the Paho client's implementation before, as well.

As an alternative that you can try to solve this problem, I put up a simple solution that can be used as a head start (since you mentioned you lost so much time debugging, it should save you a lot of time).

It's a bare-metal application running a simple MQTT client. You can test this and then build upon it to achieve your objectives. It is based on the Mongoose networking library (which includes support for MQTT and can be used as an alternative to the Paho MQTT implementation) and it should work straight out-of-the-box for the F207 board.

Hope this helps you and let me know if you encounter any issues.
https://github.com/mongoose-examples/st-f207-baremetal-mqtt-client

Regards

tarzan2
tarzan2Author
Associate III
July 30, 2025

@MStackDev_376 wrote:

It's a bare-metal application running a simple MQTT client. You can test this and then build upon it to achieve your objectives. It is based on the Mongoose networking library (which includes support for MQTT and can be used as an alternative to the Paho MQTT implementation) and it should work straight out-of-the-box for the F207 board.

Hope this helps you and let me know if you encounter any issues.
https://github.com/mongoose-examples/st-f207-baremetal-mqtt-client


Thank you for sharing this, I didn't know mongoose before. I built a new project from the online mongoose tool, making it compatible with cube IDE, I am able to rework the ioc file to add all the hardware I need. Adding all the UART and software I need, 2 Rx topics, 24 Tx topics, it is working very well since a few days, no error, even when publishing topics consecutively (24 topics = 20ms to send, including 24 snprintf with float values on STM32F2).

Unpluging / repluging the ETH cable at anytime don't make the system to crash. This was one of the multiples issues I had with the lwip+RTOS stack.

Regards

ST Employee
July 29, 2025

Hi All,

 

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.

 

Regards,
Jake

ST Support