STM32CubeMX 3 Unlock PWM module

Publisher:书香墨意Latest update time:2018-04-22 Source: eefocusKeywords:STM32CubeMX Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Today, under the guidance of a low-level expert, I learned how to configure the PWM module! Woof!

First open the file configured last time, as follows: 
Write the picture description here

Then, we need to use TIM1 to set PWM: 
Write the picture description here

Then, the clock configuration does not need to be changed 

Write the picture description here

Double-click and the following window will pop up automatically: 
Write the picture description here

Box 1 is the pre-scaling. Since the main frequency of our chip is 72MHz, the pre-scaling selection of 71 means that the timing frequency of this timer is actually 72M/(1+71)=1MHz, that is, the time interval for each addition (incremental count) or subtraction (decremental count) of this timer is 1/1M=1 microsecond.

Box 2 is the period length of the timer counter. Here, 10000 is written, which means that every time the counter reaches 10000, it will be reset and start counting again. This number determines the period of the PWM wave. Here, the period of the PWM wave is 1uS*10000=0.01S.

Boxes 3 and 4 are the variables that determine the duty cycle of the two channels. 3000 means 3000/10000=30%, a thirty percent duty cycle. 4000 here means a 40% duty cycle.

In the same window, select a different page:

Write the picture description here

NVIC is an interrupt priority manager. Since PWM does not generate interrupts here, this interrupt is optional. We do not select it here.

Then code generate.

Then 
Write the picture description here

Add these two sentences! Then you can find the PWM wave in those two ports! (After testing, there is no problem so far)

Ps: Use library function: 
Write the picture description here

The structure of opening Lib is probably like this: 
Write the picture description here

The content is as follows: 
Write the picture description here

Write the picture description here

Add the Lib file to the location just shown, build the required files, and then join the Lib group:

Write the picture description here

Write the picture description here

Then package compilation path:

Write the picture description here

Write the picture description here

Write the picture description here

Write the picture description here

After writing, sprinkle flowers


Keywords:STM32CubeMX Reference address:STM32CubeMX 3 Unlock PWM module

Previous article:STM32CubeMX: UART operation
Next article:STM32CubeMX:PWM

Recommended ReadingLatest update time:2024-11-16 12:01

Jintu launches smart cockpit platform based on Telechips Dolphin3
Based on Telechips Dolphin3, an 8-core cockpit platform SOC, Jintu launched a smart cockpit platform, using 4×A72+4×A53, adopting a hard isolation technical solution, running the Linux operating system on 4 A53s , and integrating AVM and DMS , OMS, radar, etc. are built into the system through soft methods; running
[Automotive Electronics]
Jintu launches smart cockpit platform based on Telechips Dolphin3
Transplantation of DM9000 network card driver based on S3C2440
0 Preface   Ethernet is a computer LAN networking technology. In a LAN, multiple nodes share the transmission medium. This requires some mechanism to determine which device occupies the transmission medium to transmit data at a certain time. Therefore, the link layer of the LAN must have the function of media access c
[Microcontroller]
MPLAB X IDE v3.05 cannot use ICD3 to download programs
1. Conclusion: ICD3 simulator is broken   2. Test environment 1) IDE version: MPLAB X IDE v3.05 2) Compiler toolchain: XC16 (v1.21) 3) MCU: PIC24F08KA101   3. Test methods 1) Confirm the line sequence of ICD3 2) Confirm the emulator pins on the microcontroller schematic 3) Wiring method Lead the connector from th
[Microcontroller]
Foresight Launches Six Advanced Stereo Sensor Suite to Revolutionize Industrial and Automotive 3D Perception
On November 12, Foresight Autonomous Holdings, an innovator in automotive vision systems, announced the launch of its advanced sensor suite portfolio: ScaleCam™ Vision, ScaleCam™ Thermal and QuadSight® in various configurations. These cutting-edge sensor suites are designed to enhance perception capabilities and mee
[Automotive Electronics]
Foresight Launches Six Advanced Stereo Sensor Suite to Revolutionize Industrial and Automotive 3D Perception
GigaDevice: Invested 300 million yuan to join forces with Big Fund Phase II and other investors to increase capital in Ruili Integrated
On the evening of November 11, GigaDevice announced that it plans to invest 300 million yuan to sign a capital increase agreement with multiple investors including Changxin Integration and Shixi Electric to jointly participate in the capital increase of Ruili Integration to complete the conversion investment matters a
[Mobile phone portable]
GigaDevice: Invested 300 million yuan to join forces with Big Fund Phase II and other investors to increase capital in Ruili Integrated
Experience the super dual anti-shake capabilities of Reno3 Pro with Xiao Zhan
     As OPPO's first dual-mode 5G product, OPPO Reno3 Pro is definitely "powerful". From OPPO Reno2 to the upcoming OPPO Reno3 Pro, the video super anti-shake function has been upgraded to the video super dual anti-shake function, and the anti-shake capability has been further improved. This morning, OPPO's official W
[Mobile phone portable]
s3c2440 bare metal-LCD programming (3. Framework preparation and LCD initialization)
1. Prepare the framework In order to make the program more scalable, reflect the characteristics of "high cohesion and low coupling", and be compatible with various types of LCDs, if there are two sizes of LCDs, how to quickly switch between the two LCDs? First, we abstract the common points between lcd_3.5.c and lc
[Microcontroller]
s3c2440 bare metal-LCD programming (3. Framework preparation and LCD initialization)
DSP Function Implementation Solution Based on Spartan-3 FPGA
This article describes the features of Spartan-3 FPGAs that are optimized for DSP and analyzes their performance and cost advantages through implementation examples. All low-cost FPGAs offer basic logic performance at an attractive price and can meet a wide range of general-purpose design needs. However, when consider
[Embedded]
DSP Function Implementation Solution Based on Spartan-3 FPGA
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号