Skip to main content
Visitor II
October 19, 2023
Question

Stm32 uart receive error

  • October 19, 2023
  • 2 replies
  • 1256 views

Hello. I am getting fault error or uart_waitonflaguntiltimeout error when receiving data from UART via DMA on STM32F4 series microcontrollers when the power of the device on the other side is turned off. What could be the reason for this? What should I do to solve it? Thank you.

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    October 19, 2023

    Hello @Mixolyxo 

     

    It would be helpful to share your CubeMX configuration file. You may need to check the DMA initialization. Or you can try GitHub - MaJerle/stm32-usart-uart-dma-rx-tx: STM32 examples for USART using DMA for efficient RX and TX transmission

     

    MixolyxoAuthor
    Visitor II
    October 19, 2023

    Thank you. I will try. 

    Super User
    October 19, 2023

    What kind of "fault error"? HAL error code or something like Cortex "hard fault"?  Do you have a HAL_UART_ErrorCallback() function?

    When you power off the device at the other end, it will most likely pull its TX line (your RX line) to GND (unless you are using real RS/EIA232 driver/receive chips).  To your UART this looks like either a framing error (missing stop bit) and/or "break" condition (I don't recall if the F4 has "break" detection).  The HAL UART code will terminate the receive process when it sees a framing error.