Approach advice on multiple period PWM outputs

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

cross mob
Anonymous
Not applicable

Hello! 

I had an application designed to control 16 outputs using a variable PWM period that I set via the UART.  The approach was fairly simple.  Create a PWM signal that cycles through the multiplexer using a counter of variable size (controlled by the PWM). Below is a screenshot of my current approach (you can ignore the LEDS and TP points, those were added trying to solve my new challenge):

pastedImage_0.png

Anyway, scope creep has popped up after I've designed the hardware (of course) and I need to find a new approach to try and work with the current hardware.

Rather than having a set time on each channel, I now have been asked to have variable times on each channel.  Normally, I'd look at having multiple PWM signals in parallel but, due to the high current requirements and the trace widths on the hardware, I can't enable the channels at the same time (it's for a valve application at 250mA each).  So somehow, I need to set the timing for one channel, run it for a desired time, then switch the time and activate the next one.

My idea to do it with this same block diagram is to activate an interrupt on the falling edge of the PWM signal, change the PWM timing, switch to the next channel (which is already handled with the above circuitry), and enable it again.  I assume the interrupt would set the Kill/Reset bit of the PWM to 1, change the timing, and then re-enable it again.  Then when it drops low again, I repeat the process.  The problem with this is that I can't seem to figure out how to trigger an interrupt on an active low condition on the PWM block.

Realistically, I might just need to change my entire approach for this but I thought I'd post in here and see if anyone had any recommendations on the best way to approach this.  Any information would be greatly appreciated.  Thanks!

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Jeremy,

I posted a demo operating single PWM to multiple outputs sequentially, with PWM period updating on-the-fly. It was designed to control multiple servos.

http://www.cypress.com/forum/psoc-4-architecture/using-single-pwm-block-drive-multiple-pins-using-de...

YouTube

Cypress PSoC4M 4x10-bit PWM outputs using single TCPWM block - YouTube

/odissey1

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

anks,

Thanks for the answer, I'll definitely look into it when I get home tonight (or tomorrow if I can't fit in time to look at this tonight, which is looking to be the case).  I was looking at this document and I think it's suggesting I can use the PICU interrupt in order to set it to falling edge, so that looks like what I was looking for!

Is this what you think is the best approach to this problem?

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Jeremy,

I posted a demo operating single PWM to multiple outputs sequentially, with PWM period updating on-the-fly. It was designed to control multiple servos.

http://www.cypress.com/forum/psoc-4-architecture/using-single-pwm-block-drive-multiple-pins-using-de...

YouTube

Cypress PSoC4M 4x10-bit PWM outputs using single TCPWM block - YouTube

/odissey1

0 Likes
Anonymous
Not applicable

user_343233993,

This looks like it will perfectly fit into my application!  I'll have to give it a shot when I get back from work tonight (or tomorrow, it's looking like tonight's going to be busy).  I'm excited to play around with this!  I might have more questions once I jump into it but, just looking at the video, having multiple PWM signals managed independently looks like exactly what I'm trying to do.

I'm still a bit fuzzy on exactly how all the pieces are working together (particularly with the SIN phasing) but I imagine it'll make a lot more sense when I'm able to look at this later with more time and when I have a board in front of me to observe what's going on here.

Thanks for taking the time to post this!  It should help a lot!

0 Likes