Trigger two PWM modules simultaneously

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Mrinal
Level 4
Level 4
First solution authored 50 replies posted 25 replies posted

How to start two PWM modules simultaneously?

   

I came across the function TCPWM_TriggerCommand(mask, command). But I don't know how to feed in the parameters.

   

I have two PWM modules PWM1 and PWM2, please give an example to show the use of  TCPWM_TriggerCommand() function.

   

Thank you

0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Something like this, a write to control reg starts them.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I see the command in the PWM_n.c file, but it is not descriptive enough to show how

   

to set up.

   

 

   

All else fails file a CASE and post back here results for benefit of forum.

   

 

   

To create a technical or issue case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
Mrinal
Level 4
Level 4
First solution authored 50 replies posted 25 replies posted

Hi!

   

I just learnt how to start several PWM modules simultaneously using the TCPWM_TriggerCommand() function. It's very easy!

   

1. Place several PWM components in the design and enable the external 'START'  terminal in the initial setting box.

   

2. Start all PWMs one by one using PWM_Start(). Note: this will only initialize the PWM blocks and will not start them because the external 'Start' terminal is present.

   

3. Now use the TCPWM_TriggerCommand() function to start all of them simultaneously.

   

Here is an example code with two PWM blocks.

   
    

    PWM_1_Start();
    PWM_2_Start();
    PWM_1_TriggerCommand(PWM_1_MASK|PWM_2_MASK, PWM_1_CMD_START);

   
   

Any instance of PWM can apply this command on any of the PWMs in the design. For example

   

instead of:   PWM_1_TriggerCommand(PWM_1_MASK | PWM_2_MASK, PWM_1_CMD_START);

   

we could use:  PWM_2_TriggerCommand(PWM_1_MASK | PWM_2_MASK, PWM_1_CMD_START);

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Oh, thats very nice. I need to remember this. Thanks!

0 Likes