cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS is not running task

HPham.1590
Senior

Hello, I'm using FreeRTOS on STM32F746NG.

I have created 4 task which run with the same priority.

But when I run my code,Only StartDefaultTask running, others aren't.

In debug mode, when I clicked Resume(F8), the pointer always jump to start of StartDefaultTask function.

My functions are working correctly in another project.

Anyone can help my fix this bug?

Many thanks,

Hieu

Here is my task define:

osThreadId defaultTaskHandHandle;
osThreadId MQTTTaskHandHandle;
osThreadId PubTaskHandHandle;
osThreadId UpdateTaskHandle;
void StartDefaultTask(void const * argument);
//void StartDefaultTask(void * argument);
/* USER CODE BEGIN PFP */
void MQTTTask(void *client);
void PubTask(void *argument);
void SyncTask(void *argument);
  osThreadDef(defaultTaskHand, StartDefaultTask, osPriorityNormal, 0, 4096);
  defaultTaskHandHandle = osThreadCreate(osThread(defaultTaskHand), NULL);
  osThreadDef(MQTTThread, MQTTTask, osPriorityNormal, 0, 1024);
  MQTTTaskHandHandle = osThreadCreate(osThread(MQTTThread), client);
  osThreadDef(PubThread, PubTask, osPriorityNormal, 0, 512);
  PubTaskHandHandle = osThreadCreate(osThread(PubThread), client);
  osThreadDef(UpdateThread, SyncTask, osPriorityNormal, 0, 256);
  UpdateTaskHandle = osThreadCreate(osThread(UpdateThread), client);
  /* USER CODE BEGIN RTOS_THREADS */

Here is my StartDefaultTask, this task running with TouchGFX

void StartDefaultTask(void const * argument)
{
  /* USER CODE BEGIN 5 */
//	mqtt_do_connect(argument);
  MX_TouchGFX_Process();
  /* Infinite loop */
  for(;;)
  {
    
    osDelay(1);
  }
  /* USER CODE END 5 */
}

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

and when you set a breakpoint in another task?

View solution in original post

4 REPLIES 4
KnarfB
Principal III

and when you set a breakpoint in another task?

Haithem Rahmani
ST Employee

Hi,

Are you sure that the threads were correctly created? could you check that the thread_id handles are not "NULL",

if it is the case then try to increase the FreeRTOS heap in the FreeRTOSConfig.h file.

regards

Haithem.

many thanks KnarfB, a unexpected breakpoint was set in my code but it's invisible in my debug mode. I dont know why but when I removed it, my program worked.

many thanks KnarfB, a unexpected breakpoint was set in my code but it's invisible in my debug mode. I dont know why but when I removed it, my program worked.