cancel
Showing results for 
Search instead for 
Did you mean: 

MQTT client

red1
Visitor

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:

  1. How do I configure the STM32 (using STM32CubeMX) to support Ethernet and MQTT?

  2. Are there any specific libraries or middleware (like LwIP) that I need to set up?

  3. 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

red1_0-1740644318342.png

 

1 REPLY 1

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:

https://community.st.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&filter=includeTkbs&include_tkbs=true&q=STM32H7%20ethernet