Error while setting RTC->TR and RTC->DR from STM32CubeProgrammer CLI
Hello,
I am trying to configure RTC time and date register from STM32CubeProgrammer CLI but as for now I am facing issues only. I was wondering if there's some special procedure to edit these registers straight from the programmer or not, since I am trying to replicate what's written on RM0456 to edit calendar values.
I made a simple C# console application:
uint RTC_REG_TR_BASEADDRESS = 0x46007800;
uint RTC_REG_DR_BASEADDRESS = 0x46007804;
uint RTC_REG_WPR_BASEADDRESS = 0x46007824;
uint RTC_REG_INIT_BASEADDRESS = 0x4600780C;
RunCmd($"{CLI_EXEC_PATH} -c port=swd dLPM mode=UR -hardRst -w32 {RTC_REG_WPR_BASEADDRESS} 0xCA");
RunCmd($"{CLI_EXEC_PATH} -c port=swd dLPM mode=UR -hardRst -w32 {RTC_REG_WPR_BASEADDRESS} 0x53");
RunCmd($"{CLI_EXEC_PATH} -c port=swd dLPM mode=UR -hardRst -w32 {RTC_REG_INIT_BASEADDRESS} 0x80");
Thread.Sleep(1000);
RunCmd($"{CLI_EXEC_PATH} -c port=SWD dLPM mode=UR -hardRst -w32 {RTC_REG_TR_BASEADDRESS} {RTC_REG_TR_VALUE}");
RunCmd($"{CLI_EXEC_PATH} -c port=SWD dLPM mode=UR -hardRst -w32 {RTC_REG_DR_BASEADDRESS} {RTC_REG_DR_VALUE}");
RunCmd($"{CLI_EXEC_PATH} -c port=swd dLPM mode=UR -hardRst -w32 {RTC_REG_WPR_BASEADDRESS} 0x00");RunCmd() is just a simple method that starts a process on cmd.exe. RTC_REG_TR_/DR_VALUE are BCD date and time. So, basically, I write WPR register as suggested from HAL code, then follows the initialization and eventually the writing of those registers. Unfortunately, CLI reports some errors such "Failed to download data! If it's a flash memory, it may not be erased or protected".
Do you have any clue or tip to fix this?
