Skip to main content
Uwe Bonnes
Chief
January 25, 2017
Solved

F1 RTC prescaler

  • January 25, 2017
  • 3 replies
  • 742 views
Posted on January 25, 2017 at 15:54

Hello,

while rm0008 Rev. 16 18.4.3 says:

Note: If the input clock frequency (fRTCCLK) is 32.768 kHz, write 7FFFh in this register to get a

signal period of 1 second.

STM32Cube_FW_F1_V1.4.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c writes

WRITE_REG(hrtc->Instance->PRLL, 0x00008000);

What document is right?

    This topic has been closed for replies.
    Best answer by Nesrine M_O
    Posted on January 26, 2017 at 10:46

    Hi,

    The RTC PRLL register has a reset value equal to 0x8000 and the Hal RTC DeInit function is used to reset the RTC peripheral registers to their default values (restores the peripheral default state, frees the low-level resources and removes any direct dependency with the hardware).

    -Nesrine-

    3 replies

    Oliver Beirne
    Associate II
    January 26, 2017
    Posted on January 26, 2017 at 10:00

    Hello

    I have moved your thread to the

    https://community.st.com/community/stm32-community/stm32-forum?sr=search&searchId=cd6c772b-0ae0-4541-a5bc-41dee9d8282a&searchIndex=0

    ‌ where someone should be able to assist you.

    Thanks

    Oli

    John F.
    Associate III
    January 26, 2017
    Posted on January 26, 2017 at 10:40

    The ref manual also says, fTR_CLK = fRTCCLK/(PRL+1)

    so it's clear that 0x7FFF is the correct value and HAL is wrong.

    Nesrine M_O
    Nesrine M_OBest answer
    Associate
    January 26, 2017
    Posted on January 26, 2017 at 10:46

    Hi,

    The RTC PRLL register has a reset value equal to 0x8000 and the Hal RTC DeInit function is used to reset the RTC peripheral registers to their default values (restores the peripheral default state, frees the low-level resources and removes any direct dependency with the hardware).

    -Nesrine-