-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/esp8266: fix pwm_set func #10982
cpu/esp8266: fix pwm_set func #10982
Conversation
70d121f
to
aa3f17e
Compare
For your testing procedure you should maybe clarify use term not test (it has happened in a few PRs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the pwm osci with those settings have some issues on master and this PR seems to resolve them. Tested with a scope.
It seems the code adds (80315 - 80223) 92 bytes or so, but I don't know how you can reduce so I think it is good.
Thanks, I will have it tested by tomorrow afternoon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the signs are messed up. It doesn't work anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again, all good. Please squash. ACK
In the `pwm_set` function, the switch-on and switch-off times for PWM channels were only determined for the following phase, but not for the current phase. This could result in a missing duty cycle when calling the function `pwm_set` if the switch-on time of the current phase was not yet reached or to an extended duty cycle if the switch-off time of the current phase had not yet been reached.
d3b11fc
to
d3e0b78
Compare
@MrKevinWeiss Thanks for reviewing and testing. |
Contribution description
In
pwm_set
function, switch-on and switch-off times for PWM channels were only determined for the following phase, but not for the current phase. This could result inpwm_set
was called before switch-on time of the current phase orpwm_set
was called before switch-off time of the current phase.This PR fixes the problem.
Testing procedure
Use
test/periph_pwm
with following changes inmain.c
:Flash the application with and without the changes in this PR to compare the results.
Execute the
osci
command. Without the changes of this PR, you should be able to observe one extended duty cycle every 9th cycles. That is,pwm_set
function is executed in 10th cycle and does not switch off the output port.
With changes of this PR, the output port should be switched on and off also in 10th cycle.