2025-02-27 12:24 AM
Hi ST Community,
I’m working on a project where I need to implement an MQTT client on an STM32 microcontroller. Here’s my current setup:
I have an MQTT broker running on my PC using Mosquitto.
I’ve written a simple C program for publishing messages, and it works fine on my PC (with Paho library, i use visual studio).
Now, I want to port this functionality to an STM32 board, but I’m not sure how to proceed.
I’ve found some example codes online for MQTT on STM32 (https://github.com/stm32duino/STM32Examples/blob/main/examples/Communication/MQTT/PubSubClient/mqtt_STM32Ethernet/mqtt_STM32Ethernet.ino) , but I’m struggling with the initial configuration of the STM32 (I’m new to STM32 and haven’t worked with it before). Specifically:
How do I configure the STM32 (using STM32CubeMX) to support Ethernet and MQTT?
Are there any specific libraries or middleware (like LwIP) that I need to set up?
How do I integrate the MQTT client code with the STM32 HAL (Hardware Abstraction Layer)?
Could someone guide me through the steps or point me to relevant documentation/tutorials? Any help or advice would be greatly appreciated!
I have STM32H732ZGT6
Thank you in advance!
Best regards
2025-02-27 12:54 AM
Welcome to the forum
Please see How to write your question to maximize your chances to find a solution - particularly how to properly post source code (not as an image)
@red1 wrote:I’m new to STM32 and haven’t worked with it before
Are you familiar with any other microcontroller(s) ?
MQTT sits above the TCP/IP stack - so should be well-isolated from STM32-specifics.
Some articles on Ethernet with the STM32H7: