[DigiKey "Smart Manufacturing, Non-stop Happiness" Creative Competition] Implementing STM32F746 LVGL+LwIP+MQTT data transmission and reception
[Copy link]
[DigiKey "Smart Manufacturing, Non-stop Happiness" Creative Competition] Porting FreeRTOS + LVGL + Lwip to implement TCPclient
After completing lvgl_lwip+tcp, if you need to send and receive data, then using mqtt is one of the best choices.
【Study Materials】
The learning materials for this transplantation come from Wildfire's "LwIP Application and Development Guide"
The online URL is: 21. MQTT Protocol - [Wildfire] LwIP Application Development Practical Guide - Based on Wildfire STM32 Documentation (embedfire.com)
Transplantation process
1. Download source code:
Extraction code: b92p
- After downloading, find the mqtt example and copy the MQTT folder in the source code to the project directory:
- Then copy the two files mqttclient.c/h to the Src directory:
- Modify the server IP address, username and password in mqttclient.h:
- Create two new tasks in freeRTOS and enable the recv and send tasks in the tasks:
6. Send a message in the lvgl key event, read the event in the sending task, and if there is a pressed message, send it to the server.
[Experimental results]
- Open the mqttx debugger, connect to the mqtt server, send a message, and print the message content on the serial port:
2. Press the button on the development board to publish a message, which can be received in mqttx
【discuss】
In the process of debugging mqtt, I found that FreeRTOS is difficult to control the stack size of the task. If the task stack is too large, the task will fail to start or crash during operation. Can anyone with experience give me some advice?
|