Skip to main content
SGonz.2
Associate III
June 14, 2022
Question

USART DMA stops when disconnect Rx, how do I recover and restart RX?

  • June 14, 2022
  • 3 replies
  • 3474 views

Hello!

I'm using USART with DMA and when I disconnect the Rx cable, sometimes the communication resumes and sometimes not. How can I always recover USART Rx?

I tries reseting it with RCC using the line:

RCC->APB2RSTR ^= RCC_APB2RSTR_USART1RST; // USART1

But I couldn't even receive data by USART, I'm not sure how to use it.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
June 14, 2022

You might have to check and clear any noise, framing, or other error statuses from the Rx side of the USART

You'd have to transition the reset bit twice to get a reset pulse to the peripheral.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
SGonz.2
SGonz.2Author
Associate III
June 14, 2022

Thank you! So, I have to clear the flags and reset, thank you!

GLASS
Visitor II
June 15, 2022

Hi, depending on HW, you may also verify that UART RX pin is correctly pulled-up. You can activate the internal pull-up of the stm32 uart.

SGonz.2
SGonz.2Author
Associate III
June 15, 2022

Yes! Well, that was the previous problem I solved, I activated the pull-up resistor in the UART Rx. Is that enough?

Georgy Moshkin
Senior
June 15, 2022

You can disable UART error interrupts right after init:

CLEAR_BIT(huartPtr->Instance->CR3, USART_CR3_EIE);
CLEAR_BIT(huartPtr->Instance->CR1, USART_CR1_PEIE);

but also I use software CRC32 and auto-retry for data transfers.

Check my STM32 Bootloader - flash your STM32 with AES-encrypted binaries right from web browser!
MSipo
Senior II
September 25, 2023