I am using LPC824 and trying to generate PWM with frequency modulation by using SCT timer. Datasheet is saying 'Up to six single-edge or dual-edge PWM outputs with independent duty cycle and common PWM cycle length'. 1. Whether different frequency can be

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

I am using LPC824 and trying to generate PWM with frequency modulation by using SCT timer. Datasheet is saying 'Up to six single-edge or dual-edge PWM outputs with independent duty cycle and common PWM cycle length'. 1. Whether different frequency can be

Jump to solution
2,213 Views
ranjithshanbhag
Contributor III

I am using LPC824 and trying to generate PWM with frequency modulation by using SCT timer. Datasheet is saying 'Up to six single-edge or dual-edge PWM outputs with independent duty cycle and common PWM cycle length'.  1. Whether different frequency can be configured?  2. If not, how frequency modulation can be achieved?  Carrier frequency = 500Hz and Modulated frequency = 100Khz.  Please guide me

1 Solution
1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

   You said you didn't find the .c file in the message.

  Please download my attached project, and unzip, it. you will find the .c file in folder:

LPC824_Example_Code_Bundle_IAR_r1.0\Shared_Project_Source_Code\Example_SCT_PWM_2State\src

Wish it helps you!

If you still have question, please follow this post.


Have a great day,
Kerry

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

View solution in original post

10 Replies
1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith Shanbhag,

Thank you for your interest in NXP LPC product, I would like to provide service for you!
1. Whether different frequency can be configured?  
Answer: No, you also also said the datasheet is saying:Up to six single-edge or dual-edge PWM outputs with independent duty cycle and common PWM cycle length.
common PWM cycle length is means these PWM have the same frequency. Actually, these PWM is using the same timer.

2. If not, how frequency modulation can be achieved?  Carrier frequency = 500Hz and Modulated frequency = 100Khz.
Answer: Do you want to use 500HZ and 100Khz at the same time?
  If yes, you can use two timer to realize it, actually 500HZ is very slow, you can use the other timer associate with the gpio to realize it.

Wish it helps you!
If you still have question, please let me know!

Have a great day,
Kerry

 

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

0 Kudos
1,701 Views
ranjithshanbhag
Contributor III

Hi Kerry,

I am using COUNT_L as a PWM to generate 100KHz frequency  and COUNT_H as a timer to generate 500Hz frequency. But  i am unable to achieve it.

code is like below.

    Chip_SCTPWM_SetRate_H(SCT_PWM, 500);            // COUNT_H
    Chip_SCTPWM_SetRate_L(SCT_PWM, 100000);      // COUNT_L

Here COUNT_H configuration will be overwritten by COUNT_L.

Please guide me how to achieve it.

0 Kudos
1,702 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

   You said you didn't find the .c file in the message.

  Please download my attached project, and unzip, it. you will find the .c file in folder:

LPC824_Example_Code_Bundle_IAR_r1.0\Shared_Project_Source_Code\Example_SCT_PWM_2State\src

Wish it helps you!

If you still have question, please follow this post.


Have a great day,
Kerry

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

1,701 Views
ranjithshanbhag
Contributor III

hi Kerry,

In above example counter direction is up counter. Can you help me out for up-down configuration?

0 Kudos
1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

  For the new question, could you please create a  new post?

  I will reply you in your new post.

Have a great day,
Kerry

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

0 Kudos
1,701 Views
ranjithshanbhag
Contributor III

Hi Kerry,

Thanks for sharing the code. It is really help full for us to proceed further.

We need to produce frequency modulation like mentioned earlier, Carrier frequency is 500Hz and Modulated frequency is

100KHz.(Please find the below picture). Is it possible to generate internally? so we will have modulated output in single PWM pin.

Both the Dutycycle shall be varied during run time.

pastedImage_3.jpg

0 Kudos
1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith Shanbhag,

    You can consider to use 500HZ PWM function as the timer, not PWM output.

   The timer is 1Khz, or others, it determined by your duty design.

    When the according match happens, you enable the 100Khz output. when the next match happens, you disable the 100Khz, then you will this the wave you post in one pin.

  Please try to modify it by yourself.

    Normally, for the new question, you need to post the new case.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith Shanbhag,

   Please use my attached project.

  This project will generate 500hz at PIO0_16, 100khz PWM at PIO0_12.

This is the test wave in the LPCXpresso LPC824 max board.

pastedImage_1.png

pastedImage_2.png

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

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

1,701 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

    Sorry for my last reply, after check it with our AE, common PWM cycle length is in 32bit counter.

   If you use the two 16 bit counter, it should can generate the different frequency.

   When you use the two 16bit counter, you must configure CONFIG[UNIFY] =0 . About the code, I will write a code and test it, after the function is realized, I will share it with you.

  Please wait patiently,  you also can try it on your side in the meanwhile.

Kerry

1,701 Views
ranjithshanbhag
Contributor III

Thank you #Kerry for your response.

There are 3 different counters for SCT timer(one 32bit counter and two 16 bit counter). Whether it is possible to configure 2 different frequencies using two 16 bit counters?

0 Kudos