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

Studio Bluetooth

mawu_4270096
Level 5
5 sign-ins First like received First like given
Level 5

Hi  all:

the pwm calculation: 

   Initial count = 0xFFFF - (Input Clock Freq / PWM Freq out)

   Toggle count = 0xFFFF - ((duty cycle in percentage) * (Input Clock Freq / PWM Freq out) / 100)

   so the PWM  resolution is 1/100, I want to know if I can change the PWM resolution to 1/1000

   Calculation formula:

   Initial count = 0xFFFF - (Input Clock Freq / PWM Freq out)

   Toggle count = 0xFFFF - ((duty cycle in thousandth) * (Input Clock Freq / PWM Freq out) / 1000)

 

thanks!

mandy

0 Likes
1 Solution
mawu_4270096
Level 5
5 sign-ins First like received First like given
Level 5

Hi:

  I am sure that the PWM accuracy is the root cause, now I have enhanced the PWM accuracy, the flicker question has been resolved

thanks!

mandy

View solution in original post

0 Likes
4 Replies
LinglingG_46
Moderator
Moderator 750 replies posted First comment on KBA 500 replies posted
Moderator

Could you explain the background of the questions you described?

From the description, we don't understand what do you want to do and what issue you meet?

Or could you tell us the formula where you get?

0 Likes
mawu_4270096
Level 5
5 sign-ins First like received First like given
Level 5

Hi LinglingG_46:

   the application background is to control the dimmable light brightness, we can control the PWM pulse width to change the brightness,  each time the PWM pulse width changes too much, it will cause the lamp to flicker !

the Calculation formula is supported by RanjithK_41

   Initial count = 0xFFFF - (Input Clock Freq / PWM Freq out)

   Toggle count = 0xFFFF - ((duty cycle in percentage) * (Input Clock Freq / PWM Freq out) / 100

the website is below:

CYW20719 and CYW20735 Clocks, RTC, WatchDog Timer, Application Timer and PWM

I want to know if I can change the duty cycle from percentage  to thousandth, if it is possible, it will

Improve the accuracy of PWM duty cycle

thanks!

mandy

0 Likes
Owen_Zhang123
Moderator
Moderator 500 solutions authored 250 sign-ins 1000 replies posted
Moderator

Do you check if the PWM accuracy is the root cause? I am not sure if 1% change of the PWM output will cause a flicker.

As we tested before, when you set the PWM output to 100% or 0%, the output may be wrong. Could you check if that is the problem?

mawu_4270096
Level 5
5 sign-ins First like received First like given
Level 5

Hi:

  I am sure that the PWM accuracy is the root cause, now I have enhanced the PWM accuracy, the flicker question has been resolved

thanks!

mandy

0 Likes