Skip to content

Arduino Uno PWM frequency too high #1760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
soypat opened this issue Mar 30, 2021 · 2 comments
Closed

Arduino Uno PWM frequency too high #1760

soypat opened this issue Mar 30, 2021 · 2 comments

Comments

@soypat
Copy link
Contributor

soypat commented Mar 30, 2021

As of TinyGo 0.17, Arduino Uno's PWM on pin 10 runs at 3922 Hz.This makes it unsuitable to control actuators such as Servos which usually rely on a pulse width of around 3-0.5ms.

Arduino's official documentation puts PWM frequency at 490 Hz and 980Hz, depending on the pin used.

My measurements on an oscilloscope put frequencies at:

  • D10: 3922Hz
  • D6: 490Hz (should be 980 according to Arduino) (pins 5 and 6: 980 Hz)
  • D5: 490Hz (should be 980)
  • D3: 490Hz
  • D9: 3922Hz
  • D11: 490Hz
@aykevl
Copy link
Member

aykevl commented Mar 30, 2021

This will be solved in the future with #1121, which will let you control PWM frequency.

There is not one frequency that's best in all cases, it depends on what you use the PWM for. Therefore, #1121 will make it possible to configure each PWM peripheral individually.

@deadprogram deadprogram added the next-release Will be part of next release label Apr 7, 2021
@deadprogram
Copy link
Member

This was released with v0.18 so now closing. Thank you!

@deadprogram deadprogram removed the next-release Will be part of next release label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants