RTC: Real time clock
In comparison, the RTC of STM32F407 is easier to configure than that of STM32F1. Of course, the resources of F4 are much richer. For specific resources, please refer to the official reference manual. You can also understand its general functions through the following chart
1. I didn't understand the function of ALRAM A/B at first, but I found it very simple when I looked at it later. For example, the alarm clock can also realize the function of the alarm clock. This is just a simple example to illustrate the purpose or function of ALARM A/B.
2. Automatic wake-up, timestamp and time tampering events are similar to 1. You will know it after careful experience.
3. RTC_AFO and RTC_AFI are used to output and detect external time events.
4. In general, the clock source of RTC uses LSE to generate a 1HZ clock through appropriate frequency division. There are two key points in the frequency division, namely the asynchronous frequency division factor (7bit) and the synchronous frequency division factor (15bit). The configuration of the two will affect the power consumption. The official recommendation is to configure the asynchronous frequency division factor to a higher value to reduce power consumption. The maximum value configuration is used here: SynchPrediv = 0xFF; AsynchPrediv = 0x7F; In this way, the clock is configured OK
5. Let's take a look at the initialization and configuration of RTC. I think as long as you understand it here, you will understand RTC. As for automatic wake-up, ALARM, etc., they are all very easy to configure. What's more, the ST library functions have been written, so you can directly call the relevant functions.
1) First of all, we need to know that the RTC register has a write protection function, so before each write operation, we must first exit the write protection. Here we are told very directly that we should follow this order to write 0xCA and 0x53 to RTC_WPR respectively to release the write protection. Note that the order cannot be changed. Below it, there is another sentence, write a wrong key to reactivate the write protection, that is, write a different key from the above two to reactivate the write protection function
6. I will not explain how to set specific values. The RTC_SetTime() /RTC_SetDate() and other functions in the official library can be easily implemented.
7. Finally, let's take a look at the backup register of RTC. The backup register is used for backup as its name implies. There are 20 related registers in total. A simple example can help you understand its function. For example, if we want to initialize the relevant values of RTC, I set it once for the first time. When I reset the MCU, RTC is still running normally. I don't need to reset RTC. At this time, we can add a judgment condition when setting RTC, that is, if I fill a value in the backup register I choose, if my unique value is consistent with the value I want to write, I will not reset RTC. If not, I will reset it. Of course, this value is set arbitrarily.
For example, in the official example: if (RTC_ReadBackupRegister(RTC_BKP_DR0) != 0x32F2) // Check whether the read value is consistent with the setting
{
. . . .
RTC_WriteBackupRegister(RTC_BKP_DR0, 0x32F2); //After the setting is completed, write a value to the backup register
}
8. So far, the introduction is over. It is still mainly to read the reference manual. Of course, the official library has saved a lot of functions for everyone, but it is also necessary to understand how to operate from the register level.
Previous article:The single chip microcomputer uses the RLE algorithm to realize the LCD screen display picture
Next article:How to use stm32 to write IAP bootloader and APP
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- How to use Segger Embedded Studio to develop the HPM6750?
- 485 Point-to-Many Communication Problem
- The program of the microcontroller is lost, what's going on?
- EEWORLD University Hall----Audio Amplifier for Smart Speaker
- Qorvo Expands 1.8 GHz DOCSIS 4.0 Portfolio
- Gain Circuit Compensation
- [Hua Diao Experience] 01 Getting Started with Xingkong Board
- Discharge needle under the common mode inductor
- There are new boards and self-used boards.
- Analysis of the advantages and disadvantages of crystal resonators and crystal oscillators