Debugging code (breakpoints) with reading a FIFO
Is my assumption right?
When you have code like this:
*(hospi->pBuffPtr - 1) = SPI3->RXDR;
and you set a breakpoint on this line (so that is stops before this instruction is executed),
but you have the SFR page open, to see the registers of the peripheral device, here SPI3, including the content of "register" RXDR (which is a FIFO!):

it "will" go wrong?
What could (seems to) happen:
- the open SFR page reads also the register RXDR
- but this is a FIFO!
- so, the debugger view "grabs" the data from the FIFO (and it looks correct what you see as data there)
- and when you continue: you do not get the same value from this register (FIFO): it was read already read (and removed from the FIFO) - your variable assignment "goes wrong"
So, my conclusion would be:
- if you have code where it reads from a FIFO
- set the breakpoint ONLY after the read instruction (not before or at the instruction reading "also" from this FIFO register)
Assume, that a debugger view (SFR page open and displaying the content of also of a FIFO register) will affect the behavior of the code if you keep going ("continue" or "next step": you will potentially not see the data in the variable).
FIFO registers involved can be "tricky" for debugging (using breakpoints and single step).
Is this right?
