cancel
Showing results for 
Search instead for 
Did you mean: 

Queue with uart for Nucleo L053-R8

dauphin
Associate
Posted on September 29, 2014 at 23:44

Hi,

I'm a using a Nucleo L053-R8 board and i'm trying to implement a STR system. I'm using CMSIS RTX. And i want to implement a queue in RTX with a peripheral in reception mode(uart) . I started with creating a projet without RTX. And i implemeted my uart like this :

char GetChar(void){
char a;
if(HAL_UART_Receive_IT(&huart1, (uint8_t*)aRxBuffer, 1)!= HAL_OK)
{
while(1){}
}
/*##-5- Wait for the end of the transfer ###################################*/ 
while (UartReady != SET)
{
} 
/* Reset transmission flag */
UartReady = RESET;
a=aRxBuffer[0];
return a;
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
/* Set transmission flag: trasfer complete*/
UartReady = SET;
}

with the IRQ declared like this

void USART1_IRQHandler(void)
{
HAL_NVIC_ClearPendingIRQ(USART1_IRQn);
HAL_UART_IRQHandler(&huart1);
}

It worked perfectly! i want to work in real time using rtx, so i trying to used a queue.

a = osPoolAlloc(mpool);
a[0]= aRxBuffer[0];
osMessagePut(MsgBox1, a[0], osWaitForever);

But i don't really know where i need to put the code to fill my queue. I used to work a lot with FreeRTOS and i could do :

xQueueSendFromISR( xQueueRxUart, &tmp, &xHigherPriorityTaskWoken );

With this ''

xQueueSendFromISR

'' in the uart ISR. But i don't found an equivalent method with RTX. Anyone knows how i can implement a queue in RTX with a peripheral in reception mode ? Thanks you a lot. 🙂
0 REPLIES 0