1. In current releases:
STM32/LLD/RTCv2/hal_rtc_lld.c line 572 duplicated:
RTCD1.rtc->PRER = STM32_RTC_PRER_BITS;
2. In trunk:
trunk\os\common\ports\ARM\compilers\GCC\chcoreasm.S (and counterparts under the ARMCMx path, at least)
Two offsets are defined:
#define CURRENT_OFFSET 12 /* New definition */
#define CONTEXT_OFFSET 12 /* Existing definition */
CURRENT_OFFSET isn't used, which may be intentional
(looking at port_switch_arm(), which has:
str sp, [r1, #CONTEXT_OFFSET]
ldr sp, [r0, #CONTEXT_OFFSET]
maybe one should be CURRENT_OFFSET?
)
...and a possible small addition:
3. On the 32F0 series (at least) LSI on-chip clock is 40kHz. So could the following "helper", which adjusts the RTC prescaler, be added in an appropriate place?
#if STM32_RTCSEL == STM32_RTCSEL_LSI
#define STM32_RTC_PRESA_VALUE 40 /* Used when clock is LSI */
#endif
I've added it to os\hal\ports\STM32\STM32F0xx\hal_lld.h for the F0 series, as attached.
Trivia Topic is solved
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Trivia
Hi,
1)
PRER is duplicated because this sentence in the manual: "This register must be written in initialization mode only. The initialization must be performed
in two separate write accesses.".
I am not sure it is what they meant but it works.
2)
No, it is CONTEXT_OFFSET. The other constant is there because patterns and not used, it is used in other ports.
3)
What would be the behavior when STM32_RTCSEL != STM32_RTCSEL_LSI? it would be undefined. Anyway, RTC configuration is not something the HAL driver does, we should update all of them.
Giovanni
1)
PRER is duplicated because this sentence in the manual: "This register must be written in initialization mode only. The initialization must be performed
in two separate write accesses.".
I am not sure it is what they meant but it works.
2)
No, it is CONTEXT_OFFSET. The other constant is there because patterns and not used, it is used in other ports.
3)
What would be the behavior when STM32_RTCSEL != STM32_RTCSEL_LSI? it would be undefined. Anyway, RTC configuration is not something the HAL driver does, we should update all of them.
Giovanni
Who is online
Users browsing this forum: Bing [Bot] and 37 guests