cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5: Spi and Debug

FKaes.1
Associate III

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

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

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

View solution in original post

3 REPLIES 3
TDK
Super User

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

@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
Associate III

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.