How to use PWM on iMX93 EVK board

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use PWM on iMX93 EVK board

How to use PWM on iMX93 EVK board


Overview

This document explains how to use Pulse Width Modulation (PWM) on the iMX93 EVK Board. Attached to this post is a patch to enable this functionality, which can be integrated into either Yocto or a standalone kernel compilation.

 

This procedure was tested on iMX93 EVK A0 silicon version with BSP 6.1.22 version, this feature should work on A1 silicon version too but is not tested yet.

 


  1. Kernel Configuration:
    To enable PWM support, modify the imx_v8_defconfig  file by adding the following line:
    CONFIG_PWM=y
    CONFIG_PWM_ADP5585=y
    CONFIG_PWM_CROS_EC=m
    CONFIG_PWM_FSL_FTM=m
    CONFIG_PWM_IMX27=y
    CONFIG_PWM_RPCHIP=y
    CONFIG_PWM_SL28CPLD=m
    + CONFIG_PWM_IMX_TPM=y​  # Add this line

     

  2. Device Tree Modifications:
    You will need to add the following nodes to the device tree to configure the TPM (Timer/Pulse Width Modulation) controller:
     
    + &tpm4 {
    +         pinctrl-names = "default";
    +         pinctrl-0 = <&pinctrl_tpm4>;
    +         status = "okay";
    + };
    
    ...
    
    + pinctrl_tpm4: tpm4grp {
    +         fsl,pins = <
    +             MX93_PAD_GPIO_IO05__TPM4_CH0	0x19e //EXP_GPIO_IO05 J1001 29
    +         >;
    + };​

     

  3. Compiling and Flashing:

    After making the above changes, compile the kernel and device tree. Once the compilation is complete, flash the new image and device tree to the iMX93 EVK Board.

  4.  PWM Configuration on the Board

    After flashing, you can configure the PWM settings on the board. Open a terminal and execute the following commands:


    $ cd /sys/class/pwm/pwmchip1/
    $ echo 0 >> export
    $ echo echo 2000000 >> 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

     

  5. Validation

    To validate the PWM output signal, check pin 29 of connector J1001 on the iMX93 EVK Board.


    Chavira_0-1729101922003.pngChavira_1-1729101928428.png

     

    Conclusion

    Following these steps should enable PWM functionality on your iMX93 EVK Board. If you encounter any issues, please refer to the documentation or reach out for assistance.



    Best Regards!
    Chavira
ラベル(1)
添付
コメント
abt

Hi Chavira,

Thanks for showing a way to test the PWM on the iMX93 lpddr4 EVK.
I can confirm that it works also on same EVK that has a A1 silicon. 
Your example uses the EXP_GPIO_IO05 pin which is available on J1001 connector ( channel 0 of the TPM4).

Will there be any additional configuration or setting for using a different GPIO (TPM4 channel 3), for example: 

pinctrl_tpm4: tpm4grp {
   fsl,pins = <
      MX93_PAD_GPIO_IO25__TPM4_CH3 0x19e
   >;
};

Based on configuration above, I would expect that EXP_GPIO_IO25 pin on J1001 will output the PWM wave, however there is no activity on that pin - any idea why?

I am working with a custom board based on iMX93 (A1 silicon) and need to control a peripheral device with PWM, using GPIO_IO25 pin.

Is there any way to configure TPM4 to use channel 3 (GPIO_IO25) for the PWM output?

Regards

 

 

Hi @abt!

 

Your configuration looks good but if you are using the iMX93 EVK you should disable the flexcan2 in device tree because that peripheral is using the pad GPIO_IO25.

 

Changing this line to status = "disabled"; you should be able to use the PWM in that pin.

 

 

abt

Hi Chavira,

I have disabled flexcan2 however I am still not able to confirm the PWM output on EXP_GPIO_IO25 pin.

Actually, I am facing the same problem.

abt

The following should enable channel 3 on the PWM:

echo 3 > export

On iMX93 EVK LPDDR4X, to enable pin EXP_GPIO_IO25 on J1001 connector so it will connect to GPIO_IO25 on the MCU , I configure the ADP5585 IC through i2C interface and set the GPIO 5 output high: on /dev/i2c-1 bus, for device address 0x34, write 0x10 value to register address 0x27, and then write the same 0x10 value to register address 0x23 for the same device address. After those changes you can test with the scope for PWM waves on pin  EXP_GPIO_IO25.

Regards

 

Thanks a lot

100%が役に立ったと言っています (1/1)
バージョン履歴
最終更新日:
‎10-18-2024 08:58 AM
更新者: