AnsweredAssumed Answered

DMA for unknown datareceive throw USART

Question asked by hajek.petr on Mar 18, 2013
Latest reply on Mar 18, 2013 by rocketdawg
I am working on a device which one funcion should be USART to Ethernet bridge on STM32F407. I need to receive data from USART and then work with them. But beacuse of speed I wanted to use DMA instead of interrupt after every received byte. The problem is, that I don´t know, how long will be received data=>I can´t set DMA to receive fixed number of bytes and then generate interrupt. So figured out one solution:
I will configure DMA to transfer received byte from USART everytime, when it will be received. DMA will use double buffer mode. Then, I will create some timeout function which will be called  periodically after some time. This function will always switch DMA to the second buffer and then read data from the first buffer and work with them. Is it possible? Could be a problem if I will be switching to the second DMA buffer at the same time as the DMA transfer will be working(It will be moving byte from USART  rx buffer to memory )? (I know, that it is not very probably, but I need my device very reliable.)
Or is there any better solution?
Thank you