Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
timchinowsky committed Jun 17, 2024
1 parent b87b5d2 commit fdf7f67
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/pwm/pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Blocking delays are observed when setting `duty_cycle` in the `samd` port of CircuitPython (see https://github.com/adafruit/circuitpython/issues/7653), behavior which interferes with some applications of PWM, and which differs from from that of other ports. Here is a comparison of execution times of several basic operations on three different ports, showing the off-the-charts slowness of `samd` in setting PWM duty cycle:

<img src="https://github.com/timchinowsky/circuitpython/tools/pwm/samd51_benchmarks.png", width="500" />
![](samd51_benchmarks.png)

Investigation of this issue revealed another problem concerning the method by which the API alters the requested PWM duty cycle to accommodate processor clock limitations. In some cases, the API will round a non-zero duty cycle down to zero, causing the PWM signal to stop cycling at all, which can be problematic.
This cartoon shows how for instance rounding can transform three PWM cycles, with the first almost 100% duty and the second two close to 0% duty, into one PWM cycle with three times the period and ~33% duty:
Expand Down

0 comments on commit fdf7f67

Please sign in to comment.