2017-10-30 05:23 AM
Hello ST Community,
I have three Threads Running in y code in main function I am declaring 3 Threads and suspend Two of them. My Interrupt Routine calls a function which after words resumes the one Task named 'Swing'. But While this task is running whenever interrupt occurs it does not run at all.
int main(void)
{ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_USART1_UART_Init(); MX_USART2_UART_Init(); MX_I2C2_Init();/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT(&huart2,(uint8_t *)Rx_Data,1); HAL_TIM_IC_Start_IT(&htim3,TIM_CHANNEL_2); HAL_TIM_IC_Start_IT(&htim4,TIM_CHANNEL_1);/* Create the thread(s) */
/* definition and creation of defaultTask */ osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */ osThreadDef(SwingTask, Swing, osPriorityNormal, 0, 128); SwingTaskHandle = osThreadCreate(osThread(SwingTask), NULL);osThreadDef(Task1, Task1, osPriorityNormal, 0, 100);
osThreadCreate(osThread(Task1), NULL); vTaskSuspend(defaultTaskHandle); vTaskSuspend(SwingTaskHandle);vTaskStartScheduler();
/* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler *//* Infinite loop */
/* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE *//* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */}
#multi-tasking #interrups #threads #free-rtos