Skip to main content
FKaes.1
Associate III
May 12, 2025
Solved

STM32U5: Spi and Debug

  • May 12, 2025
  • 3 replies
  • 1427 views

Hello, this is a general question for my understanding.

when I single stepped* through my SPI code, I encountered some unexpected behavior. But when I run over the code, it worked as expected.

*During this time, I had the peripheral SPI view opened.

So my question is, when the debugger updates the view, e.g. by showing me the content of the SPI_RXDR register in the peripheral view, will this already have an effect on the SPI HW, like when I read the SPI_RXDR with SW ?

Or can the debugger read the registers somehow different ?

(A read to SPI_RXDR will have effect to RXFIFO and Rx-Flags)

FKaes1_0-1747056024248.png

 

 

 

 

 

This topic has been closed for replies.
Best answer by TDK

> So my question is, when the debugger updates the view, e.g. by showing me the content of the SPI_RXDR register in the peripheral view, will this already have an effect on the SPI HW, like when I read the SPI_RXDR with SW ?

Yes, this reads RXDR which clears the RX buffer.

> Or can the debugger read the registers somehow different ?

No, the debugger uses the same reading mechanism as the cpu and has the same effects on the flags.

3 replies

TDK
TDKBest answer
May 12, 2025

> So my question is, when the debugger updates the view, e.g. by showing me the content of the SPI_RXDR register in the peripheral view, will this already have an effect on the SPI HW, like when I read the SPI_RXDR with SW ?

Yes, this reads RXDR which clears the RX buffer.

> Or can the debugger read the registers somehow different ?

No, the debugger uses the same reading mechanism as the cpu and has the same effects on the flags.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Andrew Neil
Super User
May 12, 2025

@TDK wrote:

the debugger uses the same reading mechanism as the cpu and has the same effects on the flags.


@FKaes.1 this applies in general to any & all registers.

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.
FKaes.1
FKaes.1Author
Associate III
May 13, 2025

Hi, just to confirm it, I checked with SPI view open and closed. And the behavior was like explained. With open SPI view, I wasn't able to step over my code (because the RX flags were changed, when the debugger read and display the SPI register). But with closed SPI view, I was able to step over the SPI RX code.