Enabling PWM on Pin 63 for the Colibri-IMX8X

Thank you for the clarification! You’re absolutely correct about the discrepancy between the documentation and the pinout design tool. The key issue is that PWM_H (SODIMM 63) uses the FTM (FlexTimer Module) controller, which is different from the standard LSIO PWM controllers used by PWM_D and PWM_E.

Understanding the PWM Controllers

Based on your configuration, you have:

  • PWM_D (Pin 67): LSIO_PWM2 - Working :white_check_mark:
  • PWM_E (Pin 61): LSIO_PWM3 - Working :white_check_mark:
  • PWM_H (Pin 63): ADMA_FTM_CH2 - Not working :cross_mark:

The FTM controller operates differently from the standard PWM controllers and requires additional configuration.

Checking FTM Controller Status

1. Verify FTM Controller in Device Tree

First, check if the FTM controller node exists and is properly configured. Look for the FTM controller definition in your device tree:

# Check if FTM controller is present in the device tree
find /proc/device-tree -name "*ftm*" -type d

2. Check FTM Driver Status

Verify that the FTM driver is loaded and the controller is recognized:

# Check if FTM driver is loaded
lsmod | grep ftm

# Check FTM controller registration in dmesg
dmesg | grep -i ftm

# Look for PWM controller registration
dmesg | grep -i pwm

3. Clock Configuration Verification

The FTM controller requires specific clock configuration(1). Check the clock status:

# Check clock tree for FTM-related clocks
find /sys/kernel/debug/clk -name "*ftm*" -o -name "*adma*"

# Check if ADMA clocks are enabled
cat /sys/kernel/debug/clk/clk_summary | grep -i adma

Device Tree Configuration Issues

Looking at your device tree, there might be an issue with the FTM controller reference. The FTM controller typically needs to be explicitly defined and enabled. You may need to add or verify the FTM controller node definition(2).

Suggested Device Tree Modifications

In your imx8x-colibri-eval-v3.dtsi, instead of using &adma_pwm, you might need to reference the specific FTM controller. Try modifying your configuration:

/* Enable FTM controller for PWM_H */
&ftm0 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_pwm_h>;
    status = "okay";
};

And in your LED configuration, reference the FTM controller:

col1_heater {
    label = "col1_heater";
    pwms = <&ftm0 2 1000000 0>; /* Channel 2, 1kHz, normal polarity */
    max-brightness = <255>;
    default-brightness-level = <0>;
};

Alternative Debugging Steps

1. Check Pin Function Assignment

Verify that SODIMM 63 is correctly assigned to the FTM function:

# Check current pin function
cat /sys/kernel/debug/pinctrl/*/pinmux-pins | grep -A5 -B5 "pin 63"

2. Manual PWM Testing

Try accessing the PWM directly through sysfs to bypass the LED framework:

# Find the correct PWM chip for FTM
ls /sys/class/pwm/

# If there's a pwmchip that corresponds to FTM (might be different from 0-3)
echo 2 > /sys/class/pwm/pwmchipX/export
echo 1000000 > /sys/class/pwm/pwmchipX/pwm2/period
echo 500000 > /sys/class/pwm/pwmchipX/pwm2/duty_cycle
echo 1 > /sys/class/pwm/pwmchipX/pwm2/enable

Conflict Resolution

You mentioned potential conflicts. Since you’ve already disabled FlexCAN1, ensure that no other conflicting peripherals are enabled. The key conflicts to check:

  1. CAN_1_RX: Already disabled :white_check_mark:
  2. Audio interfaces: Check if any SAI or audio controllers are using this pin
  3. Timer functions: Verify no timer peripherals conflict

Next Steps

  1. Check FTM controller presence in your device tree source files
  2. Verify FTM driver loading in kernel logs
  3. Test manual PWM access through sysfs
  4. Review clock configuration for the ADMA domain

The fundamental issue appears to be that the FTM controller requires different handling than the standard LSIO PWM controllers. The FTM controller may not be properly initialized or the device tree reference might be incorrect.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.