The problem that some channels of stm32 TIM output pwm cannot be output

Publisher:幸福旅程Latest update time:2018-07-06 Source: eefocusKeywords:stm32  pwm Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I was playing with the servo tonight and looked at the code of the example program. I wanted to change the channel to practice, so I wanted to change the channel of TIM1 from ch1 to ch2, so I changed PA8 to PA9 (it is on the data sheet), and changed TIM_OC1PreloadConfig to TIM_OC2PreloadConfig. I tried it but it didn’t work. Then I looked for where OC1 was not changed to OC2, and found that TIM_OC1Init was not changed, so I changed it to TIM_OC2Init. I tried it but it still didn’t work. I searched for a long time in pwm.c but couldn’t find it. I looked for the answer online and thought that ch2 was closed by default, but found that it was not. Later, I finally found that TIM_SetCompare1 in the main function was not changed to TIM_SetCompare2. This carelessness took me an hour to find the answer. . .



Keywords:stm32  pwm Reference address:The problem that some channels of stm32 TIM output pwm cannot be output

Previous article:How to disable STM32 TIM channels individually
Next article:stm32 PWM input capture input mode

Recommended ReadingLatest update time:2024-11-22 22:04

pic16f1937 standard PWM
Use CCP1 and CCP4 of PIC16F1937 to generate two PWM channels, and the clock source is provided by TIME2 The following is a sample program: #include pic.h #define uint8 unsigned char #define uint16 unsigned int __CONFIG(FOSC_INTOSC&WDTE_OFF&PWRTE_OFF&MCLRE_ON&CP_OFF          &BOREN_OFF&CLKOUTEN_OFF&IESO_OFF&FCME
[Microcontroller]
STM32 learning notes--personal insights on ADC functions
The ADC function of STM32 is quite complete, but I don't understand it very well. Learn it bit by bit! Before learning ADC, we need to know the relevant ADC configuration 1: The most critical clock of ADC needs to be enabled, using HSI: RCC_HSICmd(ENABLE); //Clock source selection and configuration, see clock tree Sec
[Microcontroller]
51 MCU PWM temperature control fan source code
The 51 series MCU code is as follows: #include reg52.h //Call the MCU header file #define uchar unsigned char //unsigned character macro definition variable range 0~255 #define uint unsigned int //Unsigned integer macro definition variable range 0~65535 //Digital tube segment selection definition 0 1 2 3 4 5 6 7 8 9
[Microcontroller]
Design of a program-controlled AC power supply based on a class D audio amplifier
System structure and control principle Boost + full-bridge inverter and output LC filter is one of the most commonly used topologies for high-power programmable AC power supply. As shown in Figure 1, this is a two-stage non-isolated topology, the first stage is the boost stage, which is used to boost the mo
[Power Management]
STM32 TIM1 advanced timer
Timer Application PWM Output 1.1 Differences between TIM1_CH1N and TIM1_CH1 When I was about to use the timer, I looked at the schematic diagram and found that for timer 1, each of its output channels is in pairs, that is, TIM1_CH1N and TIM1_CH1 are in a group of two. After searching on the Internet, I understood wh
[Microcontroller]
What is the difference between the regular channel and the injection channel of the STM32 ADC
Each ADC module of STM32 can switch to different input channels and perform conversions through the internal analog multiplexer. STM32 has specially added a variety of group conversion modes, which can be set by the program to automatically sample and convert multiple analog channels one by one.   There are two ways
[Microcontroller]
Comparative analysis of the advantages and disadvantages of stm32 microcontroller and pic microcontroller
stm32 microcontroller The STM32 series of microcontrollers launched by ST are known to all industry friends as being a series of microcontrollers with the highest cost-performance ratio, and they are extremely powerful. They are based on the ARM Cortex-M core designed specifically for embedded applications that requir
[Microcontroller]
Comparative analysis of the advantages and disadvantages of stm32 microcontroller and pic microcontroller
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号