akospasztor / stm32-dma-uart

Efficient DMA timeout mechanism for peripheral DMA configured in circular mode demonstrated on a STM32 microcontroller.
MIT License
125 stars 46 forks source link

DMA Timeout not Run #2

Closed yetkieu846 closed 6 years ago

yetkieu846 commented 6 years ago

I am using STM32F4 disco Kit. I am trying your code but DMA timeout Event not run. Interrupt only call when Buffer is full. What is the issues?

akospasztor commented 6 years ago

Hi, I'd recommend to check and verify the followings:

yetkieu846 commented 6 years ago

Yes, thank for your recommend. I have found the issue. "Is the UART IDLE interrupt enabled?" that right. i used __HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE); and it work perfectly

akospasztor commented 6 years ago

I'm glad that you found the issue and managed to get it work.

ghost commented 6 years ago

Hi,

It's totally safe to remove timeout and process data immendiately after IDLE interrupt happend? I don't really need timeout, I need to process the data as fast as I can. It would be still better than using byte-to-byte interrupt method for data processing.

akospasztor commented 6 years ago

It depends on your application. If you receive data from your peripheral/device which is guaranteed that there is not a single delay between characters in a burst/message, then you can rely simply on the IDLE interrupt. If not, then this approach is not safe.

Regarding the "byte-to-byte" interrupt question: it again depends on your application. If you can process data in chunks as well (and you don't have to wait until you receive each byte of the incoming message) then maybe it is a better approach. If not, then not. But in general, using DMA will reduce your overall CPU utilization.