2022-06-14 02:29 PM
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.
2022-06-14 03:06 PM
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.
2022-06-14 04:26 PM
Thank you! So, I have to clear the flags and reset, thank you!
2022-06-14 09:19 PM
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.
2022-06-14 09:46 PM
Yes! Well, that was the previous problem I solved, I activated the pull-up resistor in the UART Rx. Is that enough?
2022-06-15 12:01 AM
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.
2023-09-25 06:31 AM