STM32-General equipment unit (general input/output port, external interrupt unit, ADC conversion module, general/advanced timer, real-time clock RTC, backup register, intrusion detection pin)

Don't talk nonsense, just say:

First of all, the general equipment unit of STM32 includes the following parts, namely general input/output port (GPIO or I/O), external interrupt unit, ADC conversion module, general/advanced timer, real-time clock RTC, backup register, invasion Detection pin.

Universal input/output port

  • GPIO (80 in total) are distributed in 5 ports, each of which has 16 GPIO ports, which are named after A~E. The maximum withstand voltage is 5V. Most of the external pins can be switched from general-purpose GPIO to dedicated I/O ports for user equipment. STM32 also has an external interrupt control unit, which allows 16 GPIOs on each port to be mapped into an external interrupt input port.
  • The input and output mode can refer to the blog post in the link http://blog.sina.com.cn/s/blog_9d8bda390102w8si.html

External interrupt unit

  • The external interrupt unit (a total of 19 external interrupt (EXTI) channels) is mapped to the interrupt vector through the embedded vector interrupt controller (NVIC). Among them, the 0-15 channels of the external interrupt are connected to the GPIO pins, and the interrupt is triggered by high and low levels. The remaining 3 channels are occupied by the RTC alarm interrupt, USB wake-up interrupt and power detection unit respectively.
  • The NVIC of STM32 provides a separate interrupt vector for EXTI channels 0~4, while channels 5~9 and channels 10~15 each share an interrupt vector.
  • Detailed introduction reference link https://blog.csdn.net/zxh1592000/article/details/80280715

ADC conversion module

  • STM32 has 1~3 ADCs. Depending on the model, the ADC modules it contains are different. These ADCs can be used independently or in dual mode (increased sampling rate), which is a 12-bit successive approximation analog-to-digital converter. There are 18 channels in total, 16 of which can be used to test external signals, while the remaining two channels are connected to internal signal sources (temperature sensor, internal reference voltage).
  • For detailed introduction, please refer to the link https://blog.csdn.net/qq_43743762/article/details/100067558

General/Advanced Timer

RTC, backup register and intrusion detection pin

If we want to introduce the backup register, we must first talk about the power input in STM32. In STM32, there are two types of power input, namely the system main power supply and the backup power supply. The backup power supply often uses an external battery to provide power, as long as it supplies 10 16-bit (160 bits or 20 bytes in total) backup register, RTC clock unit and independent watchdog.

  • The backup register is actually the so-called storage space, which can be used to back up and save key data. With the support of the backup power supply, even if the STM32 enters the standby mode or the main power supply is turned off, the backup registers can still keep data from being lost. Also due to the existence of the backup power supply, the RTC clock and the independent watchdog can maintain normal operation in the low-power mode, so they can also wake up or reset the STM32.
  • There is a 32-bit real-time clock (RTC) module inside the STM32. Driven by the 32.768KHz clock frequency, RTC can generate precise second interval timing. The clock source of RTC: Low-speed internal oscillator (LSI), low-speed external oscillator (LSE) and high-speed external oscillator are divided by 128 (HSE/128) to obtain the clock. RTC will provide 3 interrupt sources: second interrupt, overflow interrupt and alarm interrupt. The alarm interrupt is generated when the RTC count matches the value in the alarm match register. The internal composition of RTC is shown in the figure.

                                                   

  • RTC also uses a backup power supply to work. The working voltage is supplied from the VBAT (internal RTC backup power pin) pin. This is the main reason why RTC can maintain normal operation after STM32 enters low power consumption mode. The RTC alarm interrupt uses the external interrupt channel No. 17 (EXTI17). Through this interrupt channel, the RTC can generate an interrupt event to wake up the STM32 (because the external interrupt detection does not require the intervention of the CPU). In the low-power working mode of the STM32 microcontroller, the CPU is often stopped, and RTC undoubtedly plays a key role in the application of STM32 to achieve timing wake-up.
  • The backup power supply also supports 10 16-bit backup registers as power backup SRAM. The contents of the backup register can be cleared by writing to the RCC Backup Control Register (RCC Backup Control Register, RCC_BCR). Corresponds to this part of the SRAM area. STM32 has an external human intrusion detection pin. After STM32 starts to run, any level edge that appears on this pin will trigger an intrusion event, and then the content of the backup register will be automatically cleared. The user can set the initial level state of the intrusion detection pin in the RCC_BCR register. Intrusion events can be applied for intrusion interrupt service, and users can take corresponding software measures in the intrusion interrupt service program to deal with the intrusion event.

 

Guess you like

Origin blog.csdn.net/qq_39530692/article/details/107763933