Tool/software: TI-RTOS
Hi all,
I want to run a http server in parallel to a mqtt client on the MSP432E401 using the simplelink sdk. I used these examples to combine into one project:
- SimpleLink MSP432E4 SDK-SysConfig Preview-Network Services-httpserver
- SimpleLink MSP432E4 SDK-SysConfig Preview-Network Services-mqttclient
Both threads start as planned, but the mqtt client now blocks the http server. No access to http is possible.
Doing a suspend in the debugger reveals that the MCU is locked in this loop (see yellow below) in mqtt_client_app.c in function "mainThread":
...
while (1)
{
gResetApplication = false;
topic[0] = SUBSCRIPTION_TOPIC0;
topic[1] = SUBSCRIPTION_TOPIC1;
gInitState = 0;
/* Connect to AP */
gApConnectionState = Mqtt_IF_Connect();
gInitState |= MQTT_INIT_STATE;
/* Run MQTT Main Thread (it will open the Client and Server) */
Mqtt_start();
/* Wait for init to be completed!!! */
while (gInitState != 0)
{
Display_printf(display, 0, 0, ".");
sleep(1);
}
Display_printf(display, 0, 0, ".");
while (gResetApplication == false);
Display_printf(display, 0, 0,
"TO Complete - Closing all threads and resources");
/* Stop the MQTT Process */
Mqtt_Stop();
Display_printf(display, 0, 0, "reopen MQTT # %d ", ++count);
}
...
I changed the marked code to:
while (gResetApplication == false) {
TaskSleep(50);
}
This seems to help, but is this intended? Is there a better way to do it? If TaskSleep is the way to go, is there a recommended value for the delay parameter?
Thanks & best regards,
Christian Seidel