当前位置:网站首页>Stm32mp1 cortex M4 Development Chapter 11: expansion board buzzer control
Stm32mp1 cortex M4 Development Chapter 11: expansion board buzzer control
2022-06-21 09:13:00 【Huaqing vision it open laboratory】
Write it at the front :
This article is 《ARM Cortex-M4 Bare metal development 》 One in a series ,, The total of the series 14 piece . The development platform used by the author is Huaqing vision FS-MP1A Development board (STM32MP157 Development board ),Cortex-M4 In addition to talking about bare metal development M4 Outside bare metal development , Will also explain through M4 Control various sensor actuator modules on the resource expansion board ( Including air temperature and humidity sensor 、LED The lamp 、 Nixie tube 、 Buzzer 、 Vibration motor 、 Key interrupt 、 Fans, etc ), This is M4 An article in the control resource expansion board .
The resource expansion board is FS-MP1A Expansion module of development board , Mainly consists of 10 More than one kind of auxiliary mainstream sensor 、 Executive device 、 Bus control device , Very convenient for project expansion . It can expand and develop smart families 、 Intelligent medical treatment 、 Intelligent security 、 Industrial control 、 Image recognition 、 Environmental detection, etc 10 About comprehensive projects , Huaqing vision development board will also provide supporting documentation for all projects 、 Experiment source code 、 Applications and other information .
in the light of FS-MP1A Development board , except Cortex-M4 Bare metal development , There are also many other series of tutorials , Include Cortex-A7 Development of article 、FreeRTOS piece 、Linux Foundation and application development 、Linux System transplantation 、Linux Driving development 、 Hardware design 、 Artificial intelligence machine vision 、Qt Application programming 、Qt Comprehensive project practice, etc . Welcome to your attention , more stm32mp157 Develop tutorials and videos , Technical exchange can be added Q Group 459754978, Thank you for attention .
FS-MP1A Development board details : TaoBao - Amoy ! I like
Catalog
1. Introduction to resource expansion board
1.1. Resource expansion board developable project
2. Expansion board buzzer control
1. Introduction to resource expansion board
1.1. Hardware introduction

1.1. Resource expansion board developable project

2. Expansion board buzzer control
2.1 Experimental principle
Open the schematic diagram of the expansion board. By comparing the expansion board, you can see that the expansion board has 1 A buzzer SP1, Here's the picture :

As can be seen from the above figure, through TIM4_CH1 The level changes the on-off of the control circuit to drive the buzzer .

Comparison diagram of interface between expansion board and backplane
See the schematic diagram TIM4_CH1 Corresponding PB6, Check the chip manual PB6 It can be used as PWM TIMER4 The passage of 1 Use , This article implements how to pass PWM Drive the buzzer :
| Schematic network number | Corresponding pin | Pin function | Pin function code |
| TIM4_CH1 | PB6 | TIM4_CH1 | AF2 |
2.2. The experiment purpose
Understand the working principle of buzzer
Study TIM in PWM How to use , Master how to use STM32MP157A Chip output PWM Wave control buzzer
2.3. Experimental environment
FS-MP1A Development platform
ST-Link Emulator
STM32CubeIDE Development software
PC machine XP、Window7/10 (32/64bit)
2.4. The experimental steps
MX To configure
According to the schematic diagram , To configure PB6 The pin is set to TIM4_CH1. Switch to TIM4 label , Check to “M4”,“Channel1” choice “PWM Generation CH1”, All configurations are shown in the figure below .


The above is the configuration process of new projects , May refer to 12.3.2 Chapter to import the existing project , Project storage path 【 Huaqing vision -FS-MP1A Development of information \02- Program source code \ARM Architecture and interface technology \Cortex-M4\10_EX_PWM_BEEP】
Code design
Find the created project , open main.c, Perfect timer interrupt callback function , In this function , Use “__HAL_TIM_SET_COMPARE()” Registers can be modified CCR, Achieve different duty cycles .
Interrupt the timer to start the function “HAL_TIM_Base_Start_IT()” And timers PWM Output start function “HAL_TIM_PWM_Start()” Put it all together .

Last main function call “TIM_PWM_Start()” You can start TIM interrupt , By changing pulse The value of can output different duty cycles PWM, The buzzer can be controlled to emit sounds of different frequencies .
Hardware platform : Huaqing vision FS-MP1A Development board (STM32MP157)
Download some development tutorials : Add QQ Group 459754978, There are in the group file .
Watch some video courses : Personal space of Huaqing vision R & D Center _ Bili, Bili _Bilibili
Taobao purchase link : Huaqing vision stm32mp157 linux Development board stm32 Single chip microcomputer arm Develop embedded learning board
Mobile Taobao sharing code : Copy the text of this line and open hand Amoy ₤T4FPXn3YYJ2₤
边栏推荐
- Ali has been working for 8 years. This learning note is left when he reaches P8. He has helped his friends get 10 offers
- How to connect the Internet - FTTH
- Abstractqueuedsynchronizer (AQS) source code detailed analysis - semaphore source code analysis
- 【实战】STM32MP157开发教程之FreeRTOS系统篇3:FreeRTOS 计数型信号量
- Six methods of optimizing inventory management in food production industry
- C#中的list操作入门
- R language through rprofile Site file, custom configuration of R language development environment startup parameters, shutdown parameters, configuration of R startup output custom text and system time
- R language through rprofile Site file, user-defined configuration of R language development environment startup parameters, shutdown parameters, user-defined specified cran local image source download
- finally block can not complete normally
- Unity Detailed explanation of meta file function
猜你喜欢

Six methods of optimizing inventory management in food production industry

Audio immersive experience
![[early knowledge of activities] list of recent activities of livevideostack](/img/8c/f8007931b1a5944f3a0a243a5afcc4.png)
[early knowledge of activities] list of recent activities of livevideostack

The difference between tuples and lists

优化食品生产行业库存管理的6种方法
![[vs], [usage problem], [solution] when VS2010 is opened, it stays in the startup interface](/img/04/a7455760caa4fc0480a034de1e24b8.png)
[vs], [usage problem], [solution] when VS2010 is opened, it stays in the startup interface

Unity write multithreading considerations

Zhihu wanzan: what kind of programmers are still wanted by the company after the age of 35? Breaking the "middle age crisis" of programmers

Abstractqueuedsynchronizer (AQS) source code detailed analysis - countdownlatch source code analysis

How to connect the Internet - FTTH
随机推荐
Doc common syntax, updating
如何使用 adb shell 查询进程流量情况
The R language uses the fix function to modify the name of the data variable through the editor. For example, use the fix function to modify the name of the dataframe data column
Linux环境下MySQL的安装过程
声临其境 — 音频沉浸体验
Tidb and MySQL modify system variables / common statements (kill the process in process)
R language uses strptime function, format to format output parameters, and R environment options parameters to convert strings into time objects (the output time information includes time, minutes, se
Idea common code templates
AQS source code exploration_ 01 handwriting a simplified reentrantlock reentrant lock
R language uses as The date function converts a single character variable to date data and specifies the format of the data format conversion
Abstractqueuedsynchronizer (AQS) source code detailed analysis - lock competitive resource analysis
The R language uses the sink function to export the string to the txt file in the specified directory. If no directory is specified, it will be output to the current working dir
Adapt to the pits in Huawei models
The way of filling holes in APK Decompilation
Unity . Net framework
Abstractqueuedsynchronizer (AQS) source code detailed analysis - countdownlatch source code analysis
STL tutorial 3- type conversion static_ cast、dynamic_ cast、const_ cast、reinterpret_ Cast method
R language obtains help information of global, package and function: use the rsitesearch function to search the information of the specified package or function in the R community help manual and arch
[Mgt] model Mgt for code interpretation
The next stop of Intelligent Manufacturing: cloud native + edge computing two wheel drive