ashwatermelon

ashwatermelon

[Study Notes] Some Terms and Calculation Formulas of STM32.

Yes, it's me again. Recently, I've been learning about STM32 timers, which are significantly more complex than the 51 series, and there are also many more terms and formulas. Here’s a simple summary to clarify what I've learned.

(1) GPIO#

"GPIO" stands for "General Purpose Input Output," which means "general input and output interface" that can accept or output signals.

(2) AFIO#

AFIO stands for "Alternate Function I/O," meaning "multiplexed function input and output." Some pins in STM32 are multiplexed, and sometimes it's inconvenient, so AFIO needs to be adjusted. AFIO also needs to be configured for interrupt pin selection during external interrupts.

  1. "EXTI" is the external interrupt register, used to monitor and identify the level signals of GPIO pins, and then request an interrupt from NVIC.
  2. "NVIC" stands for "Nested Vectored Interrupt Controller," which is used to manage and control interrupts.
  1. "PSC" stands for prescaler.
  2. "CNT" stands for counter, which overflows when CNT reaches ARR.
  3. "ARR" stands for auto-reload register.
  4. "CCR" is the abbreviation for "Capture/Compare Register," which is used to compare with ARR to generate PWM waves.
  5. "CK" stands for clock.
  6. "CK_CNT" is the timer counting frequency.
  7. "CK_PSC" is the timer's prescaler value, which is 72MHz in STM32.

(5) Calculation Formulas#

  1. Timer overflow frequency: CK_CNT_OV = CK_CNT / (ARR + 1) = CK_PSC / (PSC + 1) / (ARR + 1)
  2. PWM duty cycle: Duty = CCR / (ARR + 1)
  3. PWM frequency: Freq = CK_PSC / (PSC + 1) / (ARR + 1)
  4. PWM resolution: Reso = 1 / (ARR + 1)

I have just started learning about timers, and this is all I know about the configurations. I only have a rough understanding since I just started my freshman year, and the school hasn't opened specialized courses yet. There are many things I don't understand; I'm just learning how to use it for now and will study it in detail later.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.