Enabling TPM on A core imx8ulp-evk9

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling TPM on A core imx8ulp-evk9

410 Views
dhruvinrajpura
Contributor II

Hi @Chavira 

I am using imx8ulp-9x9-evk and in A core I want to enable TPM for that I gone through below thread
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-use-PWM-on-iMX93-EVK-board/ta-p/1... 

In my board I am using PTF19(J20->pin3) pin for generate pwm signal

 

Screenshot from 2024-12-06 17-14-02.png


I put patch in attachemnt where I add tpm5 and pinctrl_tpm5 after that I given below command but I am not able to see any signal on pin.

 

$ cd /sys/class/pwm/pwmchip0/
$ echo 0 >> export
$ echo echo 1000000 >> pwm0/period  # Set period to 2,000,000 ns (2 ms)
$ echo echo 1000000 >> pwm0/duty_cycle  # Set duty cycle to 1,000,000 ns (1 ms)
$ echo 1 >> pwm0/enable

 




Labels (1)
0 Kudos
Reply
9 Replies

309 Views
dhruvinrajpura
Contributor II

Hi @Chavira 

I am enabling CONFIG_PWM_IMX_TPM it in imx_v8_defconfig by applying patch for same &
for state of TH10_ARDUINO_SWITCH need to check but I connected anlyzer on J20.3(ARDU_D10) which is PTF19 where I am getting only high signal.

0 Kudos
Reply

354 Views
dhruvinrajpura
Contributor II

Thanks @Chavira for quick response

I applied below patched as per your suggesstions but I am not getting anything on PTF19 with logic anlyzer, You can recheck commands and patches I am applying for same, Here is attchements as well

Commands

$ cd /sys/class/pwm/pwmchip0/
$ echo 0 >> export
$ echo 1000000 >> pwm0/period  # Set period to 2,000,000 ns (2 ms)
$ echo 1000000 >> pwm0/duty_cycle  # Set duty cycle to 1,000,000 ns (1 ms)
$ echo 1 >> pwm0/enable
0 Kudos
Reply

275 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @dhruvinrajpura!

I tried and I noticed that LPSPI5 is using the PTF19 too.

By my side I disabled the LPSPI5 and I put in HIGH the signal TH10_ARDUINO_SWITCH with the command:

 

$ gpioset -c gpiochip2 10=1 &

 

Please check with dmesg command to see if you have a problem loading the proper driver because the pwm0 is not the tpm5 the pwm0 that you are watching is the tpm_rpchip_0.

 

For research purpose I use the PTF19 as a GPIO in Arduino Header without problem after that information you only have to add the tpm node in device tree.

 

Best Regards!

Chavira

0 Kudos
Reply

180 Views
dhruvinrajpura
Contributor II

@Chavira 

sharing rpmsg dtsi for reference, we are trying to use tpm5_ch0 by enabling pwm0 which is assigned to rpmsg here,
Is there any other pin where we can check this tpm on evk9?

0 Kudos
Reply

182 Views
dhruvinrajpura
Contributor II

@Chavira 

here is my dmesg logs for reference

root@imx8ulp-9x9-lpddr4-evk:~# dmesg | grep pwm
[    1.601357] virtio_rpmsg_bus virtio0: creating channel rpmsg-pwm-channel addr 0x5
[    1.607322] pwm-rpmsg virtio0.rpmsg-pwm-channel.-1.5: new channel: 0x403 -> 0x5!
[    2.137851] imx_rpmsg_pwm pwm: add PWM chip 0 successfully
root@imx8ulp-9x9-lpddr4-evk:~# dmesg | grep tpm
[    0.008544] clocksource: imx-tpm: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
root@imx8ulp-9x9-lpddr4-evk:~# 
0 Kudos
Reply

210 Views
dhruvinrajpura
Contributor II

@Chavira 

In my case PTF19 (j20.3) is always staying high and I can see that below used at many places

pinctrl-assert-gpios = <&pca6416_1 10 GPIO_ACTIVE_HIGH>;
0 Kudos
Reply

212 Views
dhruvinrajpura
Contributor II

Hi @Chavira 

I didn't get what you did in last, like have you used PTF19 as pwm and can you see waves on anlyzer?

0 Kudos
Reply

390 Views
Chavira
NXP TechSupport
NXP TechSupport

HI @dhruvinrajpura!
Thank you for contacting NXP Support!

 

Your TPM configuration looks good, however the PTF19 is muxed externally.

 

Chavira_0-1733491916801.png

 

To use that pin in the Arduino header you should add the next property to the TPM node:

 

pinctrl-assert-gpios = <&pca6416_1 10 GPIO_ACTIVE_HIGH>;

 

and additionally I recommend to disable the LPUART6.

 

in imx8ulp-evk.dts you should do the next change:

&lpuart6 {
	/* BT */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&pinctrl_lpuart6>;
	pinctrl-1 = <&pinctrl_lpuart6>;
-       status = "okay";
+	status = "disabled";

	bluetooth {
		compatible = "nxp,88w8987-bt";
	};
};

 

and delete the lpuart6 node in imx8ulp-9x9-evk.dts

 

&lpspi5 { /* conflict with lpuart6 PAD_PTF16-19 */
	status = "disabled";
};

- &lpuart6 {
- 	pinctrl-assert-gpios = <&pca6416_1 10 GPIO_ACTIVE_LOW>;
- };

 

after that additional changes you can see the output in the Arduino Header.

The PWM signal is on pin 22 of the M.2 connector with your current configuration.

 

Chavira_1-1733492408638.png

 

Best Regards!

Chavira

0 Kudos
Reply

334 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @dhruvinrajpura!

 

Are you enabling the config CONFIG_PWM_IMX_TPM in kernel?

Also can you ensure that the signal TH10_ARDUINO_SWITCH is on HIGH state?

 

I can´t test it on the board from now.

 

If the problem persist let me know.

I attached my dts recommendations.

 

Best Regards!

Alejandro

 

0 Kudos
Reply