2023-10-30 03:37 AM
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
Solved! Go to Solution.
2023-10-30 08:22 AM
How do I check parity / framing ?
2023-10-30 08:24 AM
No failures are returns from HAL_UART_xxx() functions.
2023-10-30 08:35 AM
Would suggest inspecting LPUART1->ISR
2023-10-30 08:48 AM
What should I have in this register ?
2023-10-30 08:55 AM
So ISR register goes from 0x6000d0 to 0x6000f8 after sending on RX and debbug stop.
Then after rerun and stop debbug I get 0x6000d8.
2023-10-30 07:44 PM - edited 2023-10-30 07:47 PM
Here's the Reference Manual, explains the bit flags. The 8 (bit 3) is the Overrun Error
2023-10-31 01:34 AM - edited 2023-10-31 01:34 AM
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.
2023-10-31 01:58 AM
> 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
2023-10-31 02:20 AM - edited 2023-10-31 02:28 AM
> 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.
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
2023-10-31 03:47 AM - edited 2023-10-31 03:50 AM
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