You are here

PWM as a clock devider | Cypress Semiconductor

PWM as a clock devider

Summary: 6 Replies, Latest post by Gautam Das on 19 Mar 2013 04:49 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_222091147's picture
User
25 posts

how to use PWM as a clock divider?

i tried to use it for changing clock frequency in run time. to achieve 921600 clock frequency i used the configuration as shown below but its not getting. I have given 48 MHz to clock input. What can be the problem?

user_14586677's picture
User
7648 posts

48 Mhz / .9216 Mhz = 52.083333333333333333333333333333 as a divisor,

but you have 25 as a divisor, but that does not create the 1.083 uS shown

in configurator, which tells me your clock is set to 24 Mhz, which would result

in .9216 Mhz = 1.083 uS.

 

Regards, Dana.

hli
user_78878863's picture
User
2759 posts

But why don't you use a normal clock block? You can change it during runtime too (via the Clock_SetDivider method).

user_222091147's picture
User
25 posts

Actually I tried changing runtime clock by using function

Clock_SetDivider(11);

and I have set source clock for 115200 [ 115200 * 8 = 921600 ]. Acording to datasheet by using above function my Uart should work on 9600 isnt it?

but its not working so.

In which sequence functions of clock should I use for changing freq runtime?

H L
user_460349's picture
User
1362 posts

The clock to the UART should be 8X( or 16X )of the baud rate, so for 9600 baud, you clock to the UART should be 76800( or 153600).

dasg's picture
Cypress Employee
730 posts

Hi Nilesh,

 

When using the Clock_SetDivider( ) API, please ensure that the clock "Source" in the configuration tab is chosen appropriately. When left as "Auto", Creator might select the source which you might not have expected. Hence, setting the divider might result in unexpected output frequency.

 

Did you check the clock output on an oscilloscope? What frequency did you observe it to be?

 

Thanks,

Gautam Das

user_14586677's picture
User
7648 posts

As hli pointed out sometimes we (I) miss the obvious

 

 

Log in to post new comments.