Skip to main content
Graduate
May 12, 2025
Solved

STM32U5: Spi and Debug

  • May 12, 2025
  • 2 replies
  • 428 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.

    2 replies

    TDKAnswer
    Super User
    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.

    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.

    FKaes.1Author
    Graduate
    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.