cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L031F6P7 UART1 Frame Error

Jaden
Associate

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2

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

That solved it once and for all!

Thank you very much!