Generate more than 4 PWM outputs from PSoC 4 dev kits

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

cross mob
Anonymous
Not applicable

I am just beginning to use PSoC 4. I would like to have 6 PWM outputs or more from CY8CKIT-042 PSoC 4 Pioneer Kit. When I try to use 6 TCPWM blocks together with 2 interrupts (overflow and compare events) for each block to toggle logic levels on 6 digital outputs, I get error that only max of 4 TCPWM blocks are allowed. I also tried the UDB based PWM blocks, but got errors like only max of 4 datapaths were allowed. Is there an alternative solution without resorting to pure bit-banging? Thanks. 

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Diode!

   

You can use the 4 TCPWMs and 2 UDB-based PWMs with 16 bit width. When in need, you can use the two-outputs-mode of the latter giving you 8 PWMs in total or saves you 2 TCPWMs for other uses.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob. Your advice works.

   

I also have a different question on the interrupt handling of PSoC 4. When using 4 TCPWM blocks with the same clock source and 8 interrupt handlers (4 for overflow, 4 for compare), I find they work without glitches when all compare counts are set to the same, meaning 4 interrupts can occur at the same time. From this post, ARM Cortex M only has 1 bit for pending status per interrupt source. Does that mean those 4 TCPWM blocks interrupts are actually registered as different sources? Or am I missing something?  Thanks. 

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

The only key drawback of the dual mode PWM use is the component shares

   

a common clock, the Tc output and its interrupt shared, otherwise functions as

   

two independent PWMs.

   

 

   

Regards, Dana.

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

Here is the interrupt table. attached. From the TRM.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

For a PWM component the interrupt sources are internally ORed and the result is the interrupt signal which you usually connect to an isr-component. Within the interrupt handler ypou can / should analyze the cause and act accordingly. Same goes for the TCPWM, only that the available internal sources for generating the interrupt are fewer. Do not forget to reset the interrupt cause within the handler, usually done by reading the component's state.

   

 

   

Bob

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

For a PWM component the interrupt sources are internally ORed and the result is the interrupt signal which you usually connect to an isr-component.

   

 

   

This is within the specific SCB block, eg. all the block interrupts are ORed, but the other blocks have

   

their own ISR domain.

   

 

   

Regards, Dana.

0 Likes