This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Linux cannot control timer output.

Part Number: TDA4VM


Tool/software:

Hello 

We use sdk 10,custom board。

I want to use V5 as the FSYNC signal generator for the deserializer (30Hz). I have made the following modifications.

diff --git a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
index 575df6ca8..a948df9eb 100644
--- a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
+++ b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
@@ -407,6 +407,12 @@ J721E_IOPAD(0x1d4, PIN_INPUT, 3) /* (Y3) SPI1_CS0.UART5_RXD */
 			J721E_IOPAD(0x1d8, PIN_OUTPUT, 3) /* (W4) SPI1_CS1.UART5_TXD */
 		>;
 	};
+
+	mytimer1_pins_default: mytimer1-default-pins {
+		pinctrl-single,pins = <
+			J721E_IOPAD(0x23c, PIN_OUTPUT, 2) /* (V5) TIMER_IO1 */
+		>;
+	};
 };
 
 &wkup_pmx0 {
@@ -1037,6 +1043,14 @@ clk_sensor_fixed: sensor-xclk {
         #clock-cells = <0>;
         clock-frequency = <24000000>;
     };
+
+	main_pwm1: dmtimer-main-pwm-1 {
+		compatible = "ti,omap-dmtimer-pwm";
+		#pwm-cells = <3>;
+		ti,timers = <&main_timer1>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&mytimer1_pins_default>;
+	};
 };
 
 &main_i2c1 {
diff --git a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
index de3541bd2..4f9d3cbbb 100644
--- a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
+++ b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
@@ -1129,7 +1129,7 @@ main_timer1: timer@2410000 {
 		assigned-clock-parents = <&k3_clks 50 2>, <&k3_clks 327 1>;
 		power-domains = <&k3_pds 50 TI_SCI_PD_EXCLUSIVE>;
 		ti,timer-pwm;
-		status = "reserved";
+		status = "okay";
 	};
 
 	main_timer2: timer@2420000 {
diff --git a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/configs/defconfig b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/configs/defconfig
index 05dce5a5b..74b25450f 100644
--- a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/configs/defconfig
+++ b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/configs/defconfig
@@ -1451,7 +1451,7 @@ CONFIG_PWM_IMX27=m
 CONFIG_PWM_MESON=m
 CONFIG_PWM_MTK_DISP=m
 CONFIG_PWM_MEDIATEK=m
-CONFIG_PWM_OMAP_DMTIMER=m
+CONFIG_PWM_OMAP_DMTIMER=y
 CONFIG_PWM_RCAR=m
 CONFIG_PWM_RENESAS_TPU=m
 CONFIG_PWM_ROCKCHIP=y

And add

static pinmuxPerCfg_t gTimer1PinCfg[] =
{
    /* MyTIMER1 -> TIMER_IO1 -> V5 */
    {
        PIN_TIMER_IO1, PIN_MODE(0) | \
        ((PIN_PULL_DISABLE) & (~PIN_PULL_DIRECTION & ~PIN_INPUT_ENABLE))
    },
    {PINMUX_END}
};

in pinmux.c

And I used the following commands in user space:

  1. Export the channel (only required the first time):
    echo 0 > /sys/class/pwm/pwmchip0/export

  2. Set a 30 Hz period:
    echo 33333333 > /sys/class/pwm/pwmchip0/pwm0/period

  3. Set a 50% duty cycle:
    echo 16666666 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle

  4. Enable the output:
    echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

However, the output on V5 is still 19.2 MHz and hasn’t changed.
Is there anything wrong with the way I am doing this?

BR

liupt