cancel
Showing results for 
Search instead for 
Did you mean: 

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

SGonz.2
Associate II

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.

6 REPLIES 6

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
Up vote any posts that you find helpful, it shows what's working..

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

GLASS
Senior

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.

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

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.

Disappointed with crowdfunding projects? Make a lasting, meaningful impact as a Tech Sponsor instead: Visit TechSponsor.io to Start Your Journey!
MSipo
Senior II