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.
Code is as follows:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration———————————————————-*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
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);
/ USER CODE END 2 */
/* USER CODE BEGIN RTOS
MUTEX */
/* add mutexes, … */
/* USER CODE END RTOSMUTEX */
/* USER CODE BEGIN RTOS
SEMAPHORES */
/* add semaphores, … */
/* USER CODE END RTOSSEMAPHORES */
/* USER CODE BEGIN RTOS
TIMERS */
/* start timers, add new ones, … */
/* USER CODE END RTOSTIMERS */
/* 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();
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, … */
/* USER CODE END RTOS_QUEUES */
/* 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 */
}