PWM error at 100Hz clock rate

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I'm using PSoC Creator 3.3. and Psoc4-042. Working on the BLE project with led blinking. I'm facing error from the clock and PWM at the 100Hz frequency. The error window is attached in the files. Please kindly look after.

   

This error is not only is this program, I'm facing this error in every program i was doing at 100Hz Hardware handling. 

   

 

   

Thank you 

   

Br- Gaurav Badgujar

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Changed clock to 1kHz

   

changed PWM width to 16 bits

   

changed PWM period to 999 (1 second)

   

changed compare value to 499

   

changed main() to start the PWM

   

 

   

Bob

View solution in original post

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

Welcome in the forum, Gaurav!

   

The cause of the error is listed in the first line of your compiler output. The clock divider is 16 bit wide. Hence the max divisor is 65536. From your HFCLK of 48MHz you would need a divider of 480,000.

   

Workaround: Change the PWM period and compare values to 10 times higher and use a 1kHz input clock.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks, Bob

   

please guide me for 1Hz PWM output.

   

what will be the Period value and Compare value and the clock i/p?

   

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

Best would be to post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

Furthermore a bit of explanation what you want to perform with your project (apart from blinking an LED at 1 Hz) could give you some more hints.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Look for the Workspace02.cywrk_.Archive01.zip

   

Please give me the simplest solution and how does it work for 1Hz

   

 

   

Thanks

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Changed clock to 1kHz

   

changed PWM width to 16 bits

   

changed PWM period to 999 (1 second)

   

changed compare value to 499

   

changed main() to start the PWM

   

 

   

Bob

0 Likes
Anonymous
Not applicable

It is working for me.

   

thank you, Bob.

0 Likes