STM32L051 RTCPRE bits error Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
alexblack
Posts: 276
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 32 times
Contact:

STM32L051 RTCPRE bits error

Postby alexblack » Sat Jul 22, 2017 11:41 am

Hello.
in file os/hal/ports/STM32/STM32L0xx/hal_lld.h there is an error in definition of STM32_RTCPRE_DIVx constants:

Code: Select all

...
124 /**
125  * @name    RCC_CR register bits definitions
126  * @{
127  */
128 #define STM32_RTCPRE_MASK       (3 << 29)   /**< RTCPRE mask.               */
129 #define STM32_RTCPRE_DIV2       (0 << 29)   /**< HSE divided by 2.          */
130 #define STM32_RTCPRE_DIV4       (1 << 29)   /**< HSE divided by 4.          */
131 #define STM32_RTCPRE_DIV8       (2 << 29)   /**< HSE divided by 2.          */
132 #define STM32_RTCPRE_DIV16      (3 << 29)   /**< HSE divided by 16.         */
133/** @} */
...

The reference manual on page 178 says:

Code: Select all

Bits 21:20 RTCPRE[1:0] RTC prescaler
These bits are set and reset by software to obtain a 1 MHz clock from HSE. This prescaler
cannot be modified if HSE is enabled (HSEON = 1).These bits are reset by a power -on
reset,. Their value is not modified by a system reset.

Thus the correct definiition must be:

Code: Select all

...
124 /**
125  * @name    RCC_CR register bits definitions
126  * @{
127  */
128 #define STM32_RTCPRE_MASK       (3 << 20)   /**< RTCPRE mask.               */
129 #define STM32_RTCPRE_DIV2       (0 << 20)   /**< HSE divided by 2.          */
130 #define STM32_RTCPRE_DIV4       (1 << 20)   /**< HSE divided by 4.          */
131 #define STM32_RTCPRE_DIV8       (2 << 20)   /**< HSE divided by 2.          */
132 #define STM32_RTCPRE_DIV16      (3 << 20)   /**< HSE divided by 16.         */
133/** @} */
...

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: STM32L051 RTCPRE bits error

Postby RoccoMarco » Sun Jul 23, 2017 2:53 pm

I will take a look into this.
Ciao,
RM

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: STM32L051 RTCPRE bits error  Topic is solved

Postby RoccoMarco » Wed Jul 26, 2017 5:50 pm

Fixed as Bug 866
Ciao,
RM


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 66 guests