1 (edited by muchacho 2023-05-04 07:14:58)

Topic: wolfMQTT with LwIP in STM32F2?? uController


I'm making some tests for the future use of wolfMQTT in an company project. The HW in use is a STM32F2 nucleo board. The goal, for now, is to be able to connect my controller to the <test.mosquitto.org> test broker and publish and subscribe some topics. The used IDE is STM32CubeIDE, with LwIP stack in baremetal environment.

Until now I manage to run a program that when I press a key it searches for the url IP with DNS, connects to the socket 1883 of that IP and calls the MqttClient_Connect function.After, I receive the callback to write 24 bytes, which I do. And then, the function returns with success. The problem is: only after the return, the LwIP stack confirms the data sent, and after that, I receive 11 bytes of data from the host.

How do I send the received data to the MQTT stack?

The received data from the host shall only be given to the MQTT stack upon NetRead callbacks?

I already saw that the NetRead callback is called before the network receives the expected data? How can I link these two asynchronous events, but dependent one from the other?

I'm using the wolfMQTT stack has comes in the ZIP (after decompressing) and the options.h file is set with these defines:

I'm probably not correctly understanding the usage of wolfMQTT, but if you could point me in the correct direction, I would appreciate.

Thanks in advance for your comments
Fernando Muchacho


Re: wolfMQTT with LwIP in STM32F2?? uController

Hello Fernando,

Check out our MQTT client example here for a general example of how to handle reads: https://github.com/wolfSSL/wolfMQTT/tre … mqttclient
We also have other examples in examples/ which you may find helpful: https://github.com/wolfSSL/wolfMQTT/tre … r/examples