2014-07-10 02:19 AM
Hi
I configured the USART1 with the DMA Controller to receive 16 Bytes. In case if I receive just 1 Byte (Error on the line for example or when starting the sytem) then I like to delete the whole content of the DMA Controller because otherwise the next correct 16Bytes are shiftet by this ErrorByte and in the target Register there is the ErrorByte and the 15 first Bytes of the correct message. So how can I delete the Buffer of the DMA in case of receiving less than 16 Bytes? The configuration is added as attachment. Thanks a lot. Best Regards, Dominik #usart1-dma-rx2014-07-10 02:58 AM
Stop and restart the given DMA stream.
JW2014-07-10 04:11 AM
Hi
With this 2 Commands in the IRQ Handler it doesn't works: void USART1_IRQHandler(void) { if (USART_GetITStatus(USART1, USART_IT_IDLE) != RESET) { USART_ClearITPendingBit(USART1, USART_IT_IDLE); DMA_Cmd(DMA2_Stream5, DISABLE); //RX enable -> receive DMA_Cmd(DMA2_Stream5, ENABLE); //RX enable -> receive } } It works but just the 2nd time. This means: 1. 16Bytes, Receive ok 2. 1 Byte _> disable enable 3. 16 Bytes -> doesn't works 4. 16 Bytes -> receive ok Why do I need to send it after disable/enable 2 times? Regards2014-07-10 05:01 AM
I don't use the ''library'' so can't comment on that code.
The procedure to suspend/resume and to restart a DMA transfer is described in details in RM0090 rev 7, ch.10.3.14 and 10.3.17. JW