Skip to main content
Associate
August 13, 2023
Solved

STM32L031F6P7 UART1 Frame Error

  • August 13, 2023
  • 2 replies
  • 1261 views

LPUART1_TX - PA2

LPUART1_RX - PA3

I'm having trouble testing because I'm getting frame errors by UART1.

My PCB didn't design any circuit for PA2 and PA3 because the IC that connects to the MCU's UART pin uses 3.3V TTL communication.

However, using the HAL code, the HAL_UART_Init function automatically enters the HAL_UART_ErrorCallback function even if the IC is not connected.

Interrupt and DMA methods are the same.
I am not considering the Polling method because of the possibility of missing bits.

I also use UART2, but UART2 is not a problem.

Only UART1 is the problem.

My board might be the problem, so I tested it on the NUCLEO-L031K6 board, but the result is the same.
Is there any way to solve this problem?
I am attaching the code, which is very simple, but outputs an error.
In fact, there are only three functions in the code that need to be executed to see the same problem.
MX_LPUART1_UART_Init
HAL_UART_Receive_DMA or HAL_UART_Receive_IT
HAL_UART_ErrorCallback

Hopefully we can resolve this issue.

This topic has been closed for replies.
Best answer by Tesla DeLorean

Enable PULL-UP on the RX pin so it's not floating and picking up noise.

Make sure boards are properly grounded. Check signal when getting framing. Could be issues with polarity, stop/start bits, or bit timing.

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
August 13, 2023

Enable PULL-UP on the RX pin so it's not floating and picking up noise.

Make sure boards are properly grounded. Check signal when getting framing. Could be issues with polarity, stop/start bits, or bit timing.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
JadenAuthor
Associate
August 14, 2023

That solved it once and for all!

Thank you very much!