cancel
Showing results for 
Search instead for 
Did you mean: 

UART Receive issue

EtienneLJ
Associate III

Hello,

I'm struggling with a really strange issue. I'm trying to make UART RX working on a STM32G4 custom board.

I've followed the UART Interrupt tutorial. (https://wiki.st.com/stm32mcu/wiki/Getting_started_with_UART)

I've tested it with Nucleo-G431RB and it works fine.

Now I'm running the exact same code on my custom board and I have nothing, when using the debugger I can see that the interrupt is never fired. I've check hardware connections and everything seems OK.

I've also tried to implement UART_Receive by polling mode => I can see in the debugger that characters are received, so Hardware is OK.

Can someone help me with this issue ?

Thanks

31 REPLIES 31

How do I check parity / framing ?

No failures are returns from HAL_UART_xxx() functions.

Would suggest inspecting LPUART1->ISR

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

What should I have in this register ?

 

EtienneLJ
Associate III

So ISR register goes from 0x6000d0 to 0x6000f8 after sending on RX and debbug stop.

Then after rerun and stop debbug I get 0x6000d8.

Here's the Reference Manual, explains the bit flags. The 8 (bit 3) is the Overrun Error

https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

 

g4_uart_isr.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Ok but what can be the root cause ? I seems to be a software, as I uderstand it. (SO it does not explain why it is working on the nucleo board)

When I send only one char the ORE is not set but interrupt is still not triggered.

> Ok but what can be the root cause ?

ORE is set when two or more bytes arrive to the receiver without the program reading them out from Rx data register.

There may be noise, e.g. if you connect connectors, or there may be bad ground connection... Oscilloscope is your friend.

> When I send only one char the ORE is not set but interrupt is still not triggered.

If you observe the UART Rx data register in debugger, the RXNE flag gets cleared... debugging is intrusive.

JW

There may be noise, e.g. if you connect connectors, or there may be bad ground connection... Oscilloscope is your friend.

Here's a picture of the signal received on RX pin.

NewFile1.png

 Signal seems OK.

If you observe the UART Rx data register in debugger, the RXNE flag gets cleared...

I don't get into the interrupt handler with only one char and without debugger 

So I've changed from LPUART1 to USART3 and now I don't get the ORE error when sending a char. But still no interrupt fired...

EDIT : ORE error with multiple chars as with LPUART1