STM32F407 Uart DMA transfer overrun condition
I need some clarification on using the Uart device in DMA mode
how should i handle the overrun condition (ORE bit set in SR register) ?
The read sequence SR and DR register reset the ORE bit
In DMA mode how I can do this ?
I must enable the EIE bit in CR3 register and do the reading sequence in the dma_rx_stream interrupt handler ?
static __irq void uB_UART6_DMA_RX_STREAM_handler()
{
// uint32_t Intstatus = USART6->SR ;
// uint32_t data = USART_ReceiveData(USART6) ;
uint32_t dma_isr_flags = uB_DMA_Stream_IsrFlagStatus (Uart[UART6_PORT].rx_stream) ;
uB_DMA_Stream_IsrFlagClear (Uart[UART6_PORT].rx_stream, dma_isr_flags);
if (dma_isr_flags & (DMA_ITF_TE | DMA_ITF_DME))
{
DMA_Cmd (Uart[UART6_PORT].rx_stream, DISABLE);
USART_DMACmd(USART6, USART_DMAReq_Rx, DISABLE);
if (Uart[UART6_PORT].rxcb) Uart[UART6_PORT].rxcb(UART_RX_ERROR, 0, 0) ;
Uart[UART6_PORT].rxget = 0 ;
DMA_Cmd (Uart[UART6_PORT].rx_stream, ENABLE);
USART_DMACmd (USART6, USART_DMAReq_Rx, ENABLE);
}
}Or the DMA transfer handles overrun clear the ORE bit and set the DMA transfer error bits in the appropriate LISR/HISR register ?
Thanks
