cancel
Showing results for 
Search instead for 
Did you mean: 

Calling HAL_UARTEx_ReceiveToIdle_DMA from HAL_GPIO_EXTI_Callback

pet
Visitor

Hello, 

I have a device with a variable message stream in UART and there is the issue that I cannot know when it's stream ends due to gaps (so a single ReceiveIdle won't work). The device has clear framing via an interrupt so I use that.

The final system will have limited DMA channels so keeping a ReceiveIdle always set is wasteful.

As such there is the following workflow:

  1. HAL_GPIO_EXTI_Callback gets a signal there is a new message. That arms the DMA listener.
  2.  On DMA callback, HAL_UART_Receive_IT is armed to catch possible remainder of message.
  3. On HAL_UART_Receive_IT it arms another DMA to get the rest of the stream (instead of doing a byte by byte interrupt, which is slow)
  4. We get another callback and stop the DMA/IT or we loop on IT and DMA.

The issue is if this workflow is safe? Is there an issue arming DMAs on callbacks or IT on DMA callbacks?

Thank you

 

0 REPLIES 0