IMX8 PWM source clock frequency

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

IMX8 PWM source clock frequency

2,768件の閲覧回数
eoin_oconnell
Contributor I

I am using the Toradex Verdin IMX8MP module and I need to generate a clock frequency of  1-3MHz from the PWM output pin.

I can currently get it to aroud 500kHz but after that the PWM peripheral does not behave at all even though the correct numbers are being written to the period and duty cycle registers.

 

Why am I observing this behaviour? For example when I try to put duty cycle to 10 and period to 20 in the registers I suddenly get a period of around 20ms and not 1-2us.

 

My PWM has a source clock of 24MHz, how can I change the PWM clock frequency, the datasheet shows it supports a number of different input sources, but where can I edit this source in the device tree? 

 

My dt base for the pwm looks like this:

 

			pwm2: pwm@30670000 {
				compatible = "fsl,imx8mp-pwm", "fsl,imx27-pwm";
				reg = <0x30670000 0x10000>;
				interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
				clocks = <&clk IMX8MP_CLK_PWM2_ROOT>,
					 <&clk IMX8MP_CLK_PWM2_ROOT>;
				clock-names = "ipg", "per";
				#pwm-cells = <2>;
				status = "disabled";
			};

 

The pwm get enabled higher in the DT, how can I select the other sources it supports?

 

According to the reference manual page 242 i can select these with a max of 66MHz

 

000 - 24M_REF_CLK
010 - SYSTEM_PLL1_DIV5
110 - SYSTEM_PLL1_DIV10
011 - SYSTEM_PLL1_DIV20
001 - SYSTEM_PLL2_DIV10
100 - SYSTEM_PLL3_CLK
111 - VIDEO_PLL_CLK
101 - EXT_CLK_1

 

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,230件の閲覧回数
lpheni
Contributor I

Greetings,

 

I have a similar problem.

 

After I set the PWM output, if the frequency is set to 8KHZ, period = 125000, duty_cycle = 62000, then the output is a square wave. If set to 8MHZ then the output is sine wave,period = 125, duty_cycle = 62.

 

Can you help me find out what the reason is? Thank you!

0 件の賞賛
返信

2,527件の閲覧回数
embeddeddan
Contributor I

@eoin_oconnell, I am running into the same issue you were. Did you find a solution.

 

Any help is greatly appreciated. 

 

Dan

0 件の賞賛
返信

2,686件の閲覧回数
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @eoin_oconnell,

The behavior you mentioned is odd. But from the device tree node, it looks like the node is defined properly and the PWM should work fine.

There might be a few possible reasons for this kind of behavior. To debug more, can you provide me with the following details?

  • What values are you setting in the period and duty_cycle values?
  • How are you measuring the frequency at the PWM_OUT pin?

 

Regards,
Dhruvit.

0 件の賞賛
返信