2025-11-27 4:12 AM - last edited on 2025-11-27 4:31 AM by Andrew Neil
Hello everyone,
We are developing a custom UART driver for the NUCLEO-U031R8 board where both transmit and receive operations are handled through interrupts (no HAL/LL blocking calls). However, we are facing a major issue: we are unable to reliably read from or write to the UART peripheral registers.
We have tried accessing USART registers directly (e.g., USARTx->RDR, USARTx->TDR, ISR, CR1, etc.), but the values do not change as expected during runtime. Because of this, our interrupt-driven communication never starts properly.
We have verified:
Clock to USART is enabled
GPIO pins are configured for the correct alternate function
NVIC interrupt is enabled
CR1 bits for UE, TE, RE, RXNEIE, TXEIE are set
Despite that, both TXE and RXNE interrupt behaviors do not match what we expect, and register access seems unresponsive.
Has anyone encountered similar issues on STM32U0 series or this particular NUCLEO board?
Any guidance or known pitfalls (clocking, low-power modes, register protections, etc.) would be greatly appreciated.
Thank you!
2025-11-27 4:34 AM - edited 2025-11-27 4:35 AM
Welcome to the forum.
Please see How to write your question to maximize your chances to find a solution for best results.
Please post a minimum but complete example which illustrates the issue.
PS:
Have you tried the ST (HAL-based) examples for reference?
2025-11-27 5:05 AM
A debug view of the registers may interfere with normal operation of the UART.
Best to hold values in RAM and inspect those to understand status and errors in UART.
Watch for error status that need to be cleared, like noise, parity, overflow, etc.
2025-11-27 7:18 AM
> the values do not change as expected during runtime.
They aren't memory addresses; they are registers that interface with a peripheral. When you write to TDR, don't expect to be able to read out what you wrote. Reading RDR in the debugger removes data from the peripheral--so don't.