Device tree overlay for PCA9685

I’m trying to use a PCA9685 and I see it’s enables in the kernel as a module (CONFIG_PWM_PCA9685=m) . And I have to activated with a DT overlay. As I go to look for the already available overlays at Index of /device-tree-overlays.git, it’s not clear 1) what is an overlay, and 2) what device the overlay is for. How do I determine what overlay is for the PCA9685? Once I apply the overlay I’m assuming the pwm-pca9685.c linux driver should work fine

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!


I see you’re looking to use a PCA9685 PWM controller with a Toradex module and need guidance on device tree overlays and their application.

  1. What is an overlay? A Device Tree Overlay (DTO) is a file that describes hardware configuration changes that are applied over the base device tree at runtime or boot time. It allows you to modify the hardware configuration without altering the original device tree source (DTS) file.

  2. Determining the overlay for PCA9685: To find or create an overlay for the PCA9685, you would typically look for overlays that configure I2C devices since the PCA9685 is an I2C-controlled PWM driver. If an existing overlay for the PCA9685 is not available in the Toradex Device Tree Overlays repository, you would create a custom overlay. The overlay should set the PCA9685 as a child node of the I2C controller it’s connected to, specifying the correct address and configuring it as a PWM controller.

Here’s a simplified example of what the overlay might look like:


/ {
    compatible = "toradex,<your-module-here>";

    fragment@0 {
        target = <&i2c1>; // Assuming PCA9685 is connected to i2c1. Adjust accordingly.
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            pca9685@40 { // 0x40 is the default I2C address of PCA9685. Adjust if different.
                compatible = "nxp,pca9685";
                reg = <0x40>;
                #pwm-cells = <2>;
                pwms = <&pca9685 0 0>;

This example assumes the PCA9685 is connected to the first I2C bus (i2c1) and uses the default address (0x40). You’ll need to adjust the target path to match the I2C controller your PCA9685 is connected to, and the reg property to match its address.

After creating and applying this overlay, the pwm-pca9685 driver should recognize the device and make it available for use in Linux.

Remember, the exact syntax and properties might vary based on your specific hardware setup and the Linux kernel version you’re using. Always refer to the kernel documentation for the

Please, also check if these links can help you solve your problem:

How to Use PWM on Torizon OS | Toradex Developer Center.

How did you like my response?

:+1: :-1:

I’m assuming the PCA9685 overlay already exist since the kernel config is enabled as a module. Does it already exist?

Hey @jeffbelz,

There most likely isn’t a ready made overlay to add, because its going to be specific to the module + I2C bus you want + device specific information. This is a common customization that happens when adding hardware to a system. The device, PCA9685, looks like an I2C device, so while the I2C node in the device tree exists, you will need to modify the device tree to include your specific device.

You can either modify your device tree file directly or apply a device tree overlay to ‘add your hardware’. Device tree overlays can be an easier way to modify the device tree. We have documentation here that explains more.

If using Torizon BSP 6. You can look at the kernel source code @ /Documentation/devicetree/bindings/i2c/i2c-imx.txt to see how the I2C node will be formatting. You should look at the existing device tree files for your module.

Can you let me know what hardware you are using (module and carrier board).
Your tags suggest IMX7 Verdin, and that doesn’t exist, so maybe the IMX7 Colibri or IMX8M (M/P) Verdin perhaps?
And what software you intend to use? Such as Torizon BSP 6?


It’s a verdin module, so it’s an IMX8P and I’m using Torizon BSP 6. Visual studio C++ project

Hey @jeffbelz,

Thanks for the added information. Visual Studio is a deprecated environment for our support/extension, is this a new project? I would recommend using the Visual Studio Code IDE extension if possible.

And also which carrier board are you using?


sorry, I meant to say VSCode. And I’m using the Mallow board. I’m having issue too with VSCODE. it does not seem to recognize local header files. I put my header file in the includes dir. and made sure I added the path to the compiler, but if I use #include “includes/myHeader.h” it says no file or directory. If I put the whole path it will work with local AMD 64 debug, but not the torizon arm V8. trying to figure out the issue, any ideas. intellisense see’s it. but not the compiler.

Hey @jeffbelz,

Pulling from this thread and Matheus’s statement:

VS Code will look for the headers configured in the includePath of your project .vscode/c_cpp_properties.json file.

I believe this will help your headers not being found.


i figured out the issue with the header. it has to be “…/includes/myHeader.h”
just have to back up a directory.