Skip to content

Fixed PWM frequency glitch #151

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

Merged
merged 3 commits into from
Jul 19, 2016
Merged

Fixed PWM frequency glitch #151

merged 3 commits into from
Jul 19, 2016

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jun 30, 2016

Previously the TC timer used for PWM was disabled and reenabled on each call to analogWrite, this lead to inconsistent PWM periods.

This PR fixes this behaviour.

@agdl
Copy link
Member

agdl commented Jun 30, 2016

@cmaglie good since previously holes were present in the waveform. We should also change the PWM frequency to be consistent with other boards.
Now PWM frequency on SAMD is ~186kHz, on AVR is ~960Hz

@cmaglie
Copy link
Member Author

cmaglie commented Jun 30, 2016

At the moment is 48MHz / 256 = 187.5KHz, we can prescale by another 256 and get a (weird but) more manageable: 187.500 / 256 = 732.4Hz

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b85_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Fixed PWM frequency glitch #151
  5. Select one of the boards under SAMD Pull Request Fixed PWM frequency glitch #151 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry sandeepmistry merged commit c9f315b into arduino:master Jul 19, 2016
@cmaglie cmaglie added this to the Release 1.6.7 milestone Jul 19, 2016
@cmaglie cmaglie deleted the fix-pwm branch July 19, 2016 13:16
boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this pull request May 30, 2020
minor correction to comments in variants/metro_m4/variant.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants