cancel
Showing results for 
Search instead for 
Did you mean: 

UART DMA with RTOS

Adam90
Associate

Hi all,
I spent hours but I cannot make UART work in DMA circular mode with RTOS (CMSIS V2).
Can someone send me a simple example ?
I would like to receive characters from PC (various length commands: 8-10 chars) and process them in another task parallel. Then save the position and next time start processing the commands in the buffer from the previous position.

What I experienced is that ReceiveBuffer contains one only character. When I put a breakpoint at HAL_UART_Receive_DMA line and send the characters, in next iteration I see the whole string received.
I guess somehow I have to wait till the streaming is finished.

void StartDefaultTask(void *argument)
{
   for(;;)
   {
     HAL_UART_Receive_DMA(&huart5, (uint8_t*)ReceiveBuffer, 256);
     osDelay(1);
    }
}
2 REPLIES 2
Imen.D
ST Employee

Hello @Adam90 and welcome to the Community

Please take a look at this GitHub link.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Karl Yamashita
Lead III

We have no idea what you're doing. Show your interrupt code

I Can't Believe It's Not Butter. If you find my answers useful, click the accept button so that way others can see the solution.