Commit b65cfa8e authored by Jussi Kivilinna's avatar Jussi Kivilinna Committed by Pekka Niemimaa
Browse files

stm32_serial: fix Rx DMA mode to handle and recover from USART errors

If USART peripheral detect error, Rx DMA stops operating until errors are cleared.
Signed-off-by: default avatarJussi Kivilinna <>
parent 5d539093
......@@ -2631,6 +2631,22 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
/* Get the masked USART status word to check and clear error flags.
* If error flag is not cleared, Rx DMA will be stuck. Clearing errors
* will release Rx DMA. */
priv->sr = up_serialin(priv, STM32_USART_SR_OFFSET);
if ((priv->sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE)) != 0)
#if defined(CONFIG_STM32_STM32F30XX) || defined(CONFIG_STM32_STM32F37XX)
up_serialout(priv, STM32_USART_ICR_OFFSET,
(void)up_serialin(priv, STM32_USART_RDR_OFFSET);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment