cancel
Showing results for 
Search instead for 
Did you mean: 

Uart Interrupt in FreeRTOS ?

srikanth
Associate III

I want implement FreeRTOS in my project.

I created 2 tasks

osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);

 defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

 osThreadDef(Task1, Task1, osPriorityIdle, 0, 128);

 Task1Handle = osThreadCreate(osThread(Task1), NULL);

and I initialized UART and UART receive is in interrupt.

I wrote ISR function like,

void USART1_IRQHandler(void)

{

 /* USER CODE BEGIN USART1_IRQn 0 */

uint8_t ch;

const int task_2_Param = 2;

BaseType_t xHigherPriorityTaskWoken = pdFALSE;

 /* USER CODE END USART1_IRQn 0 */

 HAL_UART_IRQHandler(&huart1);

 /* USER CODE BEGIN USART1_IRQn 1 */

Debug_Recv_BUF[Debug_Recv_BufCount] = USART1->RDR;

if(Debug_Recv_BUF[Debug_Recv_BufCount] == '}') // checking end of character

{

// xTaskNotifyFromISR( Task1Handle, 1, eSetBits, &xHigherPriorityTaskWoken ); 

vTaskNotifyGiveFromISR( Task1Handle, &xHigherPriorityTaskWoken ); 

portYIELD_FROM_ISR( xHigherPriorityTaskWoken );

}

else

{

Debug_Recv_BufCount++;

}

HAL_UART_Receive_IT(&huart1,&ch,1);

 /* USER CODE END USART1_IRQn 1 */

}

Getting characters from UART and the when I receive end of character i called vTaskNotifyGiveFromISR( Task1Handle, &xHigherPriorityTaskWoken ); function.

then code has not running ,it stopped at

ucCurrentPriority = pcInterruptPriorityRegisters[ ulCurrentInterrupt ]; (see the attached screenshot)

how can I process the data when i received End of character ?

0693W000006F5JvQAK.png

0 REPLIES 0