2021-08-29 03:52 PM
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.
Solved! Go to Solution.
2021-08-29 06:33 PM
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.
2021-08-29 06:33 PM
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.
2021-09-02 01:53 PM
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.
2021-09-02 01:59 PM
FWIW I think I found a small discrepancy in the CMSIS definitions for the HRTIM for this part, STM32G474.
HRTIM1_MASTER->MPER, HRTIM1_TIMx->PERxR are 0x0000FFDF out of reset (STM32G4 Series Reference Manual 27.5.6 and 27.5.17)
But, SFRs panel in STM32CubeIDE states 0x0000FFFF for both
Thanks!