There is no waveform output when configuring the PWM output of STM32

Publisher:程序界的行者Latest update time:2018-12-25 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the past, when organizing the code, all peripherals, such as ports, timers, serial ports, etc., were initialized when the system clock was initialized.


Today I had a sudden idea to put the initialization of each peripheral into the module of each peripheral, so that unused peripherals do not need to be given clocks, thus reducing energy consumption.


Just like that, the problem arises: there is no waveform output during PWM output.


I repeatedly checked and compared the timer's function module configuration, output IO settings, RCC configuration, etc., but I still couldn't find the cause.


When I was about to give up, I scanned the code intermittently, and suddenly I saw that the clock for the output IO was not configured before setting the output IO code, but was configured afterwards.


Is this the problem? I tried it immediately and it turned out to be the case.


This is a wake-up call!! :)


 


Therefore, you must configure the IO clock before configuring the output IO, remember this!


Keywords:STM32 Reference address:There is no waveform output when configuring the PWM output of STM32

Previous article:stm32 uses PWM wave interrupt to accurately control the number of waves
Next article:Use STM32F103 to experiment and summarize PWM related knowledge

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号