问题描述
关于如何在较新版本的内核上为PWM配置Beaglebone的信息很少. 通过插槽文件与PWM接口的过去指令已过时,因为插槽文件和bone_capemgr是在内核的v4.14 中已禁用.
There is very little information how to configure the Beaglebone for PWM on newer versions of the kernel. Past instructions for interfacing with PWM through the slots file are obsolete, as the slots file and bone_capemgr are disabled in v4.14 of the kernel.
如何使用新内核为BeagleBone Black配置PWM?我正在使用TI AM335x BeagleBone Black Wireless运行4.14.37-ti-r46内核版本.
How do I configure PWM for BeagleBone Black with the new kernel? I am using a TI AM335x BeagleBone Black Wireless running kernel version 4.14.37-ti-r46.
推荐答案
问题中提到,插槽文件和bone_capemgr是已在内核的v4.14 中禁用,取而代之的是 U-Boot覆盖.
As mentioned in the question, the slots file and bone_capemgr are disabled in v4.14 of the kernel in favor of U-Boot overlays.
如BeagleBone内核开发人员在响应中所述,U-Boot现在处理叠加层并自动启用等价于cape_enable=bone_capemgr.enable_partno=univ-all,BB-ADC,BB-PWM0,BB-PWM1,BB-PWM2
:
As explained in a response by the BeagleBone kernel developer, U-Boot now handles the overlays and automatically enables the equivalent of cape_enable=bone_capemgr.enable_partno=univ-all,BB-ADC,BB-PWM0,BB-PWM1,BB-PWM2
:
https://beagleboard.org/latest-images
对于pwm,请务必参考 https://github.com/beagleboard/bb.org-overlays/blob/master/examples/cape-unversal-pwm.txt 和config-pin pwm< pin#> ..
For the pwm's make sure to reference https://github.com/beagleboard/bb.org-overlays/blob/master/examples/cape-unversal-pwm.txt and the config-pin pwm <pin#>..
因此,PWM接口已经配置!现在只需导出并使用PWM.例如,访问pwm0:
Therefore, the PWM interface is already configured! Now just export and use the PWM. For example to access pwm0:
root@beaglebone:~# cd /sys/class/pwm/pwmchip0
root@beaglebone:/sys/class/pwm/pwmchip0# ls
device export npwm power subsystem uevent unexport
root@beaglebone:/sys/class/pwm/pwmchip0# echo 0 > export
root@beaglebone:/sys/class/pwm/pwmchip0# ls
device export npwm power pwm-0:0 subsystem uevent unexport
root@beaglebone:/sys/class/pwm/pwmchip0# ls pwm-0:0
capture device duty_cycle enable period polarity power subsystem uevent
注意:如果引脚已经在使用中,则可能需要在/boot/uEnv.txt
中使用disable_uboot_overlay_video=1
禁用HDMI.
Note: you might need to disable HDMI with disable_uboot_overlay_video=1
in /boot/uEnv.txt
if the pins are already in use.
要确定PWM接口的引脚映射,请参见我的后续文章.
To determine the pin mapping for the PWM interfaces, see my follow-up post PWM chip to pin mapping on BeagleBone Black (v4.14).
这篇关于BeagleBone Black(v4.14)上的PWM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!