Skip to main content
VGusi.1
Associate
August 29, 2021
Solved

What is the trick to view SFRs in debug?

My sincere apologies for what I am sure is an idiot newbie's error. Thank you everyone for your time.

I have STM32CubeIDE and I do not seem to be able to read back values of SFRs (peripheral registers) while in debug. E.g. my code contains

HRTIM1_MASTER->MCR = 0xD;

In the SFRs panel both before and after this statement is executed, MCR is zero, which is its reset value. Same in pop-up window when I mouse over HRTIM1_MASTER->MCR in the source-code file.

I see that e.g. the PLL is being configured correctly, likely in SystemClock_Config(). When I look at PLLSYSN at a breakpoint, it is not at its reset value and is at the value that it is set to in SystemClock_Config().

STM32CubeIDE is 1.7.0 and my hardware is STM32G474E-EVAL1. I tried various combinations of settings in Debug Configurations -> Debugger. The debugger correctly connects in each case but my code appears unable to modify the SFR in each case, that is, I do not read back by the debugger the value I set in my user code.

This topic has been closed for replies.
TDK
TDKBest answer
August 30, 2021

Sounds like you are able to view them just fine, but that they don't give the values that you expect.

Did you enable the HRTIM1 clock?

Other possibilities include the SVD file containing the wrong address for this register.

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

3 replies

TDK
TDKBest answer
August 30, 2021

Sounds like you are able to view them just fine, but that they don't give the values that you expect.

Did you enable the HRTIM1 clock?

Other possibilities include the SVD file containing the wrong address for this register.

"If you feel a post has answered your question, please click ""Accept as Solution""."
VGusi.1
VGusi.1Author
Associate
September 2, 2021

Thank you!! Yes, because I am new to a microcontroller that is so complex, I missed this in STM32G4 Series Reference Manual 7.2.17:

"When the peripheral clock is not active, the peripheral registers read or write accesses are not supported."

I added an initialization consistent with the first four paragraphs of Reference Manual 27.3.24 and now I can read back the values I program into HRTIM1 control registers.