Skip to content
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

PWM: Read current duty_ns and pwm_ns before setting default values #110

Merged
merged 3 commits into from
Sep 3, 2016

Conversation

pdp7
Copy link
Collaborator

@pdp7 pdp7 commented Sep 3, 2016

@Dark-Guan reported an issue in this comment for PR #108 after it was merged:

I use Linux kamikaze 4.1.6-bone15 Tue Aug 18 12:45:47 UTC 2015 armv7l GNU/Linux

File "testHardPwm.py", line 6, in
PWM.start("P9_14", 50 , 2000, 1)
RuntimeError: Problem with a sysfs file

When I run testing demo, the error I get above.
It's nice that if some body can tell me the problem,thanks!

@MatthewWest worked with @Dark-Guan to identify the issue and develop a fix:

The invalid argument when setting the duty cycle happens when the duty cycle is set to longer than the period of the pwm. This was happening because we weren't reading the current duty_ns and period_ns from the files. I've written a short patch which reads the current duty_ns and pwm_ns from the files before setting the default values, in order to set the duty and period in the correct order.
That said, I've written the changes but don't have access to a BeagleBone for the next 2 weeks. So I haven't tested my changes at all, even to see if it will compile. You're welcome to try the code in the develop branch of my repository. I won't submit a pull request until I've had a chance to test it.

I am raising this Pull Request on the behalf of @MatthewWest after testing his develop branch.

@pdp7
Copy link
Collaborator Author

pdp7 commented Sep 3, 2016

I've run the PWM tests OK for:

  • Debian 8.5 (2016-08-14):
    • Linux beaglebone 4.1.15-bone18
    • Linux beaglebone 4.1.14-bone17
    • Linux beaglebone 4.1.6-bone15
  • Debian 8.5 (2016-06-05):
    • Linux beaglebone 4.4.11-ti-r29
  • Debian 8.2 (2015-12-07):
    • Linux beaglebone 4.1.13-ti-r35 GNU/Linux
    • Linux beaglebone 4.4.19-bone13
  • Debian 7.5 (2014-05-14):
    • Linux beaglebone 3.8.13-bone50

@pdp7
Copy link
Collaborator Author

pdp7 commented Sep 3, 2016

@Dark-Guan: could you please test, as well, and let me know if you run into any issues?

@MatthewWest: thanks for your efforts!

@MatthewWest
Copy link
Contributor

@pdp7 You're welcome for the fix, thanks for opening a pull request!

@pdp7 pdp7 merged commit 52d92f9 into adafruit:master Sep 3, 2016
@pdp7 pdp7 changed the title Read current duty_ns and pwm_ns before setting default values PWM: Read current duty_ns and pwm_ns before setting default values Sep 3, 2016
lromor pushed a commit to lromor/adafruit-beaglebone-io-python that referenced this pull request Sep 13, 2016
Read current duty_ns and pwm_ns before setting default values
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

Successfully merging this pull request may close these issues.

2 participants