Hello,
we are facing following issues while using qurt thread. Using SDK 3.2 for qca4020. building the code with threadx rtos.
1) We created qurt thread using api qurt_thread_create having priority as 10, stack size as 2048. Thie thread is been created in Initialize_onboard_demo function in file onboard.c.
The thread is running continuously in while(1) loop as seen below.
void thread_1(void)
{
while(1)
{
if(flag == 1)
{
//execute code
}
else if(a > b)
{
//execute code
}
}
}
This code gets stuck as soon as it is created. But if we introduce qurt_thread_sleep(1); at the end of the while loop it runs properly. As you can see below.
void thread_1(void)
{
while(1)
{
if(flag == 1)
{
//execute code
}
else if(a > b)
{
//execute code
}
qurt_thread_sleep(1);
}
}
2) Have noticed that when the code runs for a long time for above mention thread the complete code hangs due to the thread and the device goes in EDL mode as can be seen in device manager. What can be the reason?
3) If we create multiple thread in same .c file, only one thread runs and the other thread does not perform any action even if flag is set to 1.
4) We are getting MQTT_CLIENT_NOT_IDLE_ERROR when we call publish function outside the aws_thread function. We referred aws forum for this solution https://forums.aws.amazon.com/thread.jspa?threadID=237345.
What all files we need to add if we defined the macro _ENABLE_THREAD_SUPPORT_ in your aws_iot_config.h as it is showing error while compiling when we add macro _ENABLE_THREAD_SUPPORT_ in your aws_iot_config.h file.
Any help will be appreciated.
Thank you
Akshaay
Hello Akshaay,
I think problems 1, 2 and 3 above are related to thread priorities and your current thread seems to hog cpu. Please use a lower priority for your thread which will allow other threads in the system to function properly
thanks,
Steven