STM32H755 - RTC->SSR & RTC->SHIFTR
Dears, I have issues with setting RTC shift register.
I have setup RTC with AsynchPrediv = 127 & SynchPrediv = 255 and is working normally.
I tried to periodically setting RTC->SHIFTR with value 100 each 5 secs. Then wait for the shift operation to complete and immediately I read SS back using register RTC->SSR register. But RTC->SSR provide "random values" in PREDIV_S range (0 - 255). I expect that it should be lower than 100 but close (not higher)
Where could be problem ?
Thanks in advance
Radim
Example code:
int main(void)
{
unsigned this_ssr, tick, tr, dr;
reset_backup_domain();
...
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART3_UART_Init();
MX_RTC_Init();
...
// Turn on shadow registers to speed up RTC operations
HAL_RTCEx_EnableBypassShadow(&hrtc);
...
while(1)
{
__HAL_RTC_WRITEPROTECTION_DISABLE(&hrtc);
HAL_PWR_EnableBkUpAccess();
RTC->SHIFTR = 100; // test value
// Wait for the shift operation to complete
while ((hrtc.Instance->ISR & RTC_ISR_SHPF) != 0) {}
HAL_PWR_DisableBkUpAccess();
__HAL_RTC_WRITEPROTECTION_ENABLE(&hrtc);
/* Read all 3 registers. */
this_ssr = READ_REG(RTC->SSR);
tr = READ_REG(RTC->TR);
dr = READ_REG(RTC->DR);
HAL_Delay(5000); // wait cca 5 sec
}
