Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure and implement pwm buzzer in Android device tree kernel

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This "Android device tree kernel how to configure and achieve pwm buzzer" article most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "Android device tree kernel how to configure and achieve pwm buzzer" article.

In the iMX6 development board device tree kernel how to configure pwm, the document takes the PWM of the buzzer as an example, and sets the default GPIO configuration to PWM.

1 device tree modification

Here, select the network CSI_PWN of the buzzer to configure, and the corresponding IO is SD1_DAT2.

Open the "arch/arm/boot/dts/imx6qdl-sabresd.dtsi" device tree file, the default configuration is

"MX6QDL_PAD_SD1_DAT2__GPIO1_IO19", as shown in the following figure, comment it out.

In the device tree code, add the following PWM configuration.

This is shown in the following figure.

Add devices for PWM2

Recompile and burn to the development board.

2 sys test

Here we do not add driver code, we can directly use sys, the default pwm sys has been configured.

After burning the new device tree image, use the command

Echo 0 > sys/class/pwm/pwmchip1/export initializes pwm and configures it as pwm

If you cancel, use the "echo 0 > sys/class/pwm/pwmchip1/unexport" command.

Once configured as pwm, use the following command:

Echo 1 > / sys/class/pwm/pwmchip1/pwm0/enable enable

Echo 1000000 > / sys/class/pwm/pwmchip1/pwm0/period configure period to

1000000

Echo 500000 > / sys/class/pwm/pwmchip1/pwm0/duty_cycle configure duty_cycle to

500000, you can hear the buzzer.

Echo 100000 > / sys/class/pwm/pwmchip1/pwm0/duty_cycle configure duty_cycle to

100000, you can hear the buzzer.

Echo 0 > / sys/class/pwm/pwmchip1/pwm0/duty_cycle configure duty_cycle is 0, bee

The buzzer stopped ringing.

The above is the content of this article on "how to configure and implement pwm buzzer in the Android device tree kernel". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report