2021-09-30 11:13 AM
Hi,
I've used STM32CubeMX to configure my STM32H7 MCU, but RTC initial values which I set on CubeMX as default value are not set on RTC_TR and RTC_DR registers after debugging line by line when MX_RTC_Init() is called. There is no fault reported or any hardfault..., and I've use LSI for RTC.
Please help in this simple issue which waste my time couple of days ...
Thanks.
2021-10-04 09:06 AM
While in INIT mode, you won't see changes made to DR and TR registers (*).
You have to exit INIT mode and wait for reload (clear RSF and wait until hardware sets it), then you will see the new values of TR/DR.
JW
(*) unless you set RTC->CR.BYPSHAD
2021-10-05 11:54 AM
1- I've checked all things, LSI is works fine, because I can read time and calendar...(Time is alive)
2- First write protection is disabled... I assume that it is worked because INITF and INIT could be set in next step.
2- I checked RTC_ISR when goning to Init mode, INITF and INIT are set and RSF is zero.
3- After assigning a value to RTC_TR, next step is exiting from init mode.
4- I checked, when ISR_INITF and RSF set to zero after some tick, RSF became one....
5- enabling write protection....
After all these steps which their code is developed by CubeMX and I checked all steps and registers... unfortunately RTC_DR and RTC_TR values dose not changed...and they start from some random numbers usually zero and one... It is so weird, I stuck in this simple part for a week....
Please check and help me... I have checked all thing which we discussed here.. no progress :loudly_crying_face:
@Community member
@Community member
2021-10-05 12:54 PM
Is this a custom board?
Have you tried porting/using some existing examples, perhaps built to printf() to your serial debug terminal?
STM32Cube_FW_H7_V1.8.0\Projects\STM32H743I-EVAL\Examples\RTC\RTC_TimeStamp\Src\main.c
Make sure clocking sources are working and correctly selected. Output LSI via MCO/PA8, or other pins you might be able to expose it on. Check it is running via RCC/PWR peripheral registers.
Write some code to dump all the interrelated registers, its going to be impossible to play guess-whats-wrong remotely, without some clean/clear code and full register dumps. No one is going to want to dig into register level code as it is involved and expensive. Work all the HAL examples.
Assume the RTC is going to be running several hundred times slower than the MCU, watch for timing, and write buffer flushing expectations.