AGX Thor T5000 Enable PWM2 no output

Hi NVTeam,

On my T5000 OEM Board with JetPack7.2, I want to use GPIO27(H52) pin as PWM2 function.
I have change the PINMUX spreadsheet and Kernel DTS as below:

#include "tegra264-p4071-0000+p3834-0008-nv.dts"

/ {
        bus@0 {
                pwm@810c5e0000 {
	            status = "okay";
                };
       };
};

And in the OS, I can see the pinmux and pwmchip all worked,


But, I can’t measure any waveform from the GPIO27 pin with the oscilloscope?
Is there anything wrong with my operation?

By the way, in order to test my hardware connection:
I set the GPIO27(H52) pinmux as GPIO, and pull HIGH and LOW with gpiod tools.
I can measure the changes in voltage levels using a multimeter.
This should mean that there is no problem with my hardware connection.

Hi kang.pan,

Do you have the AGX Thor devkit board to reproduce the similar issue?

Your operation and commands look good to me.
Could you try configuring other period/duty_cycle value to check if there’s any PWM signal output?

Hi KevinFFF,

This signal on the DevKit is not routed externally, so it cannot be tested.

I have test the below period/duty_cycle values:
period=10000, duty_cycle=5000, Yes
period=100000, duty_cycle=50000, Yes
period=1000000, duty_cycle=500000, Yes
period=10000000, duty_cycle=5000000, No

I think it should be same as this post, and I know what to do now.
Many Thanks!

Hi,
I follow the Dev Guide, to set the PWM2 output 30Hz.

Test Case 1:
Set the DTS property nvidia,pwm-depth = <65535>;
When I set the 30Hz output in sysfs: period=33333333, duty_cycle=16666666,
I can measure the PWM output with oscilloscope, it is 29.46Hz.

/ {
        bus@0 {
                pwm@810c5e0000 {
                         assigned-clocks = <&bpmp TEGRA264_CLK_PWM2>;
                         assigned-clock-parents = <&bpmp TEGRA264_CLK_OSC>;
                         nvidia,pwm-depth = <65535>;
                         status = "okay";
                };
        };
};

Test Case 2:
Set the DTS property nvidia,pwm-depth = <449>; to get more precise output frequency.
When I set the 30Hz output in sysfs: period=33333333, duty_cycle=16666666,
I can not measure the any output from the same pin.

/ {
        bus@0 {
                pwm@810c5e0000 {
                         assigned-clocks = <&bpmp TEGRA264_CLK_PWM2>;
                         assigned-clock-parents = <&bpmp TEGRA264_CLK_OSC>;
                         nvidia,pwm-depth = <449>;
                         status = "okay";
                };
        };
};

When I set the nvidia,pwm-depth = <449>;, I have tested more target freq, the result is as below:

Target Freq PFM Measure with Oscilloscope
1kHz 59
~469Hz 127
~234Hz 255
~117Hz 511 ❌ No output
100Hz 599 ❌ No output
30Hz 1999 ❌ No output

Seems the PFM range is only 0 ~ 255 (8bit width).
This is incomapatible with the .scale_width = 16 in tegra-pwm.c seems inconsistent with actual measurements.

static const struct tegra_pwm_soc tegra264_pwm_soc = { 
        .channel_offset = 0,
        .depth_offset = 4,
        .depth_shift = 15, 
        .depth_width = 16, 
        .duty_shift = 16, 
        .duty_width = 16, 
        .enb_offset = 4,
        .num_channels = 1,
        .scale_shift = 0,
        .scale_width = 16, 
        .has_depth_csr = true,
};

Hi kang.pan,

We can reproduce the similar issue as yours.
I’m checking this with internal team.

Before that, you can simply configure nvidia,pwm-depth = <0xe0f>; for exact 30Hz output.
27000000Hz/(1+3599)/(1+249) = 30Hz
I have verified it working on my setup:

Hi KevinFFF,
OK,got it! Thanks for your reply.

Hi kang.pan,

We have identified the cause of the “No output” issue seen with some pwm-depth and PFM combinations on Thor. On Thor, the hardware requires PWM_DEPTH >= PFM; otherwise, no waveform is generated

Please check whether you observe results similar to the ones below:

Parent Clock - OSC (Hz) Target PWM output
frequency (Hz)
PWM_DEPTH PFM Waveform Result
27000000 30 3599 249 Pass
27000000 30 1799 499 Pass
27000000 30 999 899 Pass
27000000 30 899 999 No Output