AnsweredAssumed Answered

DMA reads from USART1 without RXNE set

Question asked by litty on May 6, 2014
Latest reply on Jun 23, 2014 by Amel N
Hi community,
I use the USART1 in STM32F100C4 to receive serial data in DMA mode. Because the data comes in packets with less than 16 bytes I start the DMA mode every time, when new data is expected. This works most of the time well.
But in some cases, DMA is not new started, because data is not of interest and DMA reads only 16 bytes to the memory. then DMA stops the transfer.

Next time data is expected, DMA is new started in the same manner like before:
  DMA_Cmd(DMAChannel_USART1_RX, DISABLE);
  DMAChannel_USART1_RX->CNDTR = 16;
  DMA_Cmd(DMAChannel_USART1_RX, ENABLE);
But now immediatly after DMA is enabled, the last data in USART1_DR is read to the memory althougt RXNE is cleared!

It seems, this undesirable data is only read after DMAChannel_USART1_RX->CNDTR has count to 0 in last DMA session and more data is unread received.
A resolution to that problem is allmost when I restart DMA mode like above. But I prefer to know the reason for this problem rather I solve it in this kind.

Thanks for your help,
Best reards,
Herbert

Outcomes