PWM Frequency and resolution question

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

cross mob
Anonymous
Not applicable

I am experimenting with PSoc 4200's PWM.

While running the processor in 48Mhz, and with count of 255, I am getting ~180khz frequency. Is there something that I am not configuring correctly?

255 resolution won't be enough for my application.

Thanks!

0 Likes
1 Solution

No, that will not work:

48MHz / 300 kHz = 160

This shows that you can get only 160 steps resolution instead of your wanted 4096 steps.

Bob

View solution in original post

8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You could use a TCPWM component which is 16 bit wide and runs at max. 48MHz clock.

Another solution is the PWM component configured as 16 bit wide which runs at 43 MHz clock max.

Bob

0 Likes
Anonymous
Not applicable

Thanks. But I am using TCPWM with 48Mhz Clock feeding into the PWM. Setting PWM period to 255 with Prescaler x1, gives about ~180khz.

0 Likes
Anonymous
Not applicable

That comes out to a clock period of about 266.667, with an error percentage of 4.575% difference from 255.

You wouldn't happen to be turning the PWM on/off, would you? Or modifying the period/count/settings? That might account for the difference in frequency...

You might need to change the settings within the TCPWM module; There is a setting to left-align, right-align, etc the PWM output, as well as inverting the outputs. And the values should be able to go up to 65535

0 Likes

So what period and resolution do you need?

Bob

0 Likes
Anonymous
Not applicable

I was hoping I could get 300khz with 12bit (4096) resolution. I guess this is not possible.

0 Likes

No, that will not work:

48MHz / 300 kHz = 160

This shows that you can get only 160 steps resolution instead of your wanted 4096 steps.

Bob

muga_metal,

Take a look on DDS32 component demo in this thread

Need a programmable frequency generator

Unlike the PWM, which output frequency accuracy worsening as ~f^2, DDS has flat accuracy in entire working band (in expence of some jitter).

/odissey1

Anonymous
Not applicable

Thanks Bob anduser_342122993​ .

0 Likes