简体   繁体   English

Linux 在 sysfs 中启用 pca9685

[英]Linux enable pca9685 in sysfs

I would like to enable a PCA9685 as a PWM in /sys/class/pwm/ .我想在/sys/class/pwm/启用PCA9685作为PWM

The Platform is a Raspberry Pi 2 and the chip is connected to /dev/i2c-1 .平台是Raspberry Pi 2 ,芯片连接到/dev/i2c-1

I find the chip with i2c-detect , but i don't know how do I enable this driver: http://lxr.free-electrons.com/source/drivers/pwm/pwm-pca9685.c .我找到了带有i2c-detect的芯片,但我不知道如何启用此驱动程序: http : //lxr.free-electrons.com/source/drivers/pwm/pwm-pca9685.c I also found this but it doesn't tell me how to configure sysfs to use this driver: https://www.kernel.org/doc/Documentation/pwm.txt .我也发现了这个,但它没有告诉我如何configure sysfs来使用这个驱动程序: https : //www.kernel.org/doc/Documentation/pwm.txt

You need to enable CONFIG_PWM_PCA9685 in your .config file of your linux-kernel .您需要在linux-kernel .config文件中启用CONFIG_PWM_PCA9685 By default, CONFIG_PWM_PCA9685 is not set and you need to enable it as CONFIG_PWM_PCA9685=y if you want to build it as a part of kernel image, or as CONFIG_PWM_PCA9685=m if you want to build it as a LKM .默认情况下, CONFIG_PWM_PCA9685 is not set ,如果要将其构建为内核映像的一部分,则需要将其启用为CONFIG_PWM_PCA9685=y如果要将其构建为LKMCONFIG_PWM_PCA9685 is not set需要将其启用为CONFIG_PWM_PCA9685=m

Also make sure that CONFIG_SYSFS is enabled in your .config .还要确保CONFIG_SYSFS在您的.config enabled If CONFIG_SYSFS is enabled in your kernel configuration, a simple sysfs interface is provided to use the PWMs from userspace.如果在内核配置中启用了CONFIG_SYSFS ,则会提供一个简单的sysfs接口来使用来自用户空间的PWMs It is exposed at /sys/class/pwm/ .它暴露在/sys/class/pwm/ Each probed PWM controller/chip will be exported as pwmchipN , where N is the base of the PWM chip .每个探测到的PWM controller/chip将作为pwmchipN导出,其中NPWM chip的基数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM