Skip to content
Advertisement

Linux enable pca9685 in sysfs

I would like to enable a PCA9685 as a PWM in /sys/class/pwm/.

The Platform is a Raspberry Pi 2 and the chip is connected to /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. 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.

Advertisement

Answer

You need to enable CONFIG_PWM_PCA9685 in your .config file of your linux-kernel. By default, CONFIG_PWM_PCA9685 is not set and you need to enable it as CONFIG_PWM_PCA9685=yif you want to build it as a part of kernel image, or as CONFIG_PWM_PCA9685=mif you want to build it as a LKM.

Also make sure that CONFIG_SYSFS is enabled in your .config. If CONFIG_SYSFS is enabled in your kernel configuration, a simple sysfs interface is provided to use the PWMs from userspace. It is exposed at /sys/class/pwm/. Each probed PWM controller/chip will be exported as pwmchipN, where N is the base of the PWM chip.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement