Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
57
/
631
4. Set the 20 bit prescaler based on the measurement results and the desired RTC time base and independent watchdog
timeout.
System clock (SYSCLK) selection
The system clock (SYSCLK) has four clock sources: MSI, HSI, HSE, PLL.
The maximum frequency of the system clock is 108 MHz. After a system reset, the MSI oscillator (with a reset
frequency of 4MHz) is selected as the system clock. It cannot be stopped when the clock source is used directly or
indirectly through the PLL as the system clock.
Switching from one clock source to another will only occur when the target clock source is ready (either after a delay
to start the stabilization phase or PLL stabilization). When the selected clock source is not ready, the switching of the
system clock will not occur until the target clock source is ready.
Clock security system (CLKSS)
Clock security system can be activated by software by setting the RCC_CTRL.CLKSSEN bit. Once activated, the
clock detector is enabled after the startup delay of the HSE oscillator, and disabled when the HSE clock is turned off.
If the HSE clock fails, the HSE oscillator will be automatically turned off, and a clock failure event will be sent to
the break input of the advanced timers (TIM1 and TIM8), and the Clock Security System Interrupt CLKSSIF will be
generated, allowing the software to execute rescue operations. The CLKSSIF interrupt is connected to the NMI (Non-
Maskable Interrupt) interrupt of the Cortex™-M4.
Once the CSS is activated and the HSE clock fails, the CSS interrupt is generated and the NMI is automatically
generated. The NMI will be executed continuously until the CSS interrupt pending bit is cleared. Therefore, it is
necessary to clear the CSS interrupt by setting the RCC_CLKINT.CLKSSICLR bit in the NMI handler.
If the HSE oscillator is directly or indirectly used as the system clock (indirectly means: it is used as the PLL input
clock, and the PLL clock is used as the system clock), the clock failure will cause a switch of the system clock to the
MSI oscillator and the disabling of the external HSE oscillator. If HSE clock (divided or not) is selected as PLL input
clock then upon HSE clock failure, the PLL will be turned off.
LSE Clock security system (LSECSS)
The LSE clock security system is activated by enabling the RCC_LDCTRL.LSECLKSSEN bit. The
RCC_LDCTRL.LSECLKSSEN bit can be cleared by a hardware reset or RTC software reset or after detection of an
LSE fault. When LSE and LSI are enabled and ready, the RCC_LDCTRL.LSECLKSSEN bit must be enabled after
configuring the RCC_LDCTRL.RTCSEL to select the RTC clock source.
If an LSE failure is detected, no more LSE will be provided to the RTC, but the RCC_LDCTRL.RTCSEL bits will
not be modified by hardware to switch the RTC clock source.
In Standby mode, an LSE clock failure triggers a wake-up. In other modes, an interrupt can be generated to wake up,
and then the software can clear the RCC_LDCTRL.LSECLKSSEN bit and turn off the LSE, and change the RTC
clock source and other measures to ensure the safety of the application.