How to change PWM frequency

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to change PWM frequency

跳至解决方案
2,448 次查看
Hiroki
NXP Employee
NXP Employee

Hi,

I'd like to know hot to generate the function to change the PWM frequency.

PE can generate the setRatio(). This setRatio can change the duty of PWM.

I'd like to change the PWM frequency. However, I cannot find the method to change the PWM frequency.

Could you show me which method can change it?

Best Regards,

Hiroki

标记 (2)
0 项奖励
1 解答
1,776 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Hiroki,

I just checked, you need set PPG period as "interval" . the default one is "fix" which can not work with Setperiod related method.

see attached video for where to set it.

can this help you


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
6 回复数
1,775 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Hiroki.

if you need change PWM period, we need to use PPG(programmable Pulse generation) component instead. there is SetPeriod related method for it.

can this help?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
1,775 次查看
Hiroki
NXP Employee
NXP Employee

Hi Zhang,

Would you mean PPG_LDD? I selected PPG_LDD but SetPeriod method was selected "don't generate code" and I couldn't change that configuration.

How should I do to select "generate code" of SetPeriod?

Best Regards,

Hiroki

0 项奖励
1,777 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Hiroki,

I just checked, you need set PPG period as "interval" . the default one is "fix" which can not work with Setperiod related method.

see attached video for where to set it.

can this help you


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
1,775 次查看
vijenad
Contributor III

Before going for main project, we want to understand the components, trying to generate PWM by using PPG1:PPG (not looking into  type of waveform generated and other points),  I am flashing the code on TRJ-KEA128 board, but led on-boar connected at output is not blinking.

(Same configuration - I tried with Running Settings type- Fixed, it works)

And also can you explain more on Init Value, Low Limit, High Limit and how they are related to the type of output we want to generate?

for(;;)

  {

  PPG1_Enable();

            PPG1_SetPeriodSec(1);

PPG1_SetDutyMS(500);

PPG1_SetRatio8(120);

}

1,775 次查看
vijenad
Contributor III

Code to generate square wave form with varying frequency in run time.  Duty cycle is constant - 50%. Frequency is varied in run time

for(;;)

  {

   PPG1_SetRatio16(PPGPtr,32767);

  PPG1_SetPeriodMS(PPGPtr,1);

    for(i=0;i<65535;i++)

    {

    __asm("nop");

    }

    PPG1_SetPeriodMS(PPGPtr,10);

    for(i=0;i<65535;i++)

        {

    __asm("nop");

        }

     }

from interval - the table has three rows that contain the Initial value, low limit and high limit of the interval. Allows to change a timing freely within a selected interval (for low limit to high limit), while all values of the interval are selected with specified precision. Prescaler value is fixed in this mode, timing is set only using compare/reload registers value. It means that it is possible to reach all values within the interval by using the same prescaler.

1,776 次查看
Hiroki
NXP Employee
NXP Employee

Hi Zhang,

Thank you very much for your help.

It can help me to understand.

Best Regards,

Hiroki

0 项奖励