I wrote a code with freeRTOS multi threading and gsm mqtt.
My environment: https://github.com/rogerclarkmelbourne/Arduino_STM32
And issue is: Code with freeRTOS900 or pubsubclient individually working fine but when I’m using both together the controller hangs unexpectedly…
Please help me to find reasons for RTOS hanging?
I had some bad experience with a similar situation, in my case a ESP32 (also freeRTOS based) with an ethernet arduino shield. What usually happens is that the Arduino Ethernet libraries are very old and are not well suited for a real-time OS. Sometimes the problem comes from the way the library handles Interrupts for catching incoming messages, holding the resource captive way longer than it’s acceptable for the RTOS, if not properly informed/configured.
My suggestion would be to either find a MQTT library that does not depend on the standard arduino ethernet library, and if that fails try to first find an ethernet library compatible with the STM32/RTOS, then try to adapt some MQTT library to that library.