cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-U031R8 – Unable to Read/Write UART Registers in Interrupt Mode

_Pranay_
Visitor

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!

3 REPLIES 3
Andrew Neil
Super User

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?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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.

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

> 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.

If you feel a post has answered your question, please click "Accept as Solution".