Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more. Accepting essential orders - here's how.
0

BBI0 PWM Bug
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BBI0 PWM Bug

by alarm on Sun Aug 07, 2016 11:31 am

Hello,
I'm in the Debian GNU / Linux 7.11 (wheezy) kernel 3.8.13-bone80.
I made a python3 script to generate 6 frequencies with a time interval of 15 seconds:
78,156,312,625,1250,2500 Hz
This works fine except that the 4th frequency (625 Hz here) does not pass, I stay on the Previous frequency for 15 seconds.
If I replace 625Hz with another I have the same bug.


Here is the script:
import time
Adafruit_BBIO import from PWM
freq400k_pin = "P9_14" fixed #frequence for therapeutic pulse
freq_var_pin = "P8_19" #frequence modulating
freq_var_liste = (78,156,312,625,1250,2500) # Tuple of 6 frequencies
CYCLE_TIME = 15 #duree cycle: 15 seconds
PWM.start (freq400k_pin, 45, 400000)
PWM.start (freq_var_pin, 0, 50)
try:
while True:
for freq in freq_var_liste:
print ( "= frequency" freq "Hz")
PWM.start (freq_var_pin, 50, freq)
time.sleep (CYCLE_TIME)

except KeyboardInterrupt:
PWM.cleanup ()

Someone there you an idea of ​​the bug?
Thank you

alarm
 
Posts: 4
Joined: Sun Aug 07, 2016 11:17 am

Re: BBI0 PWM Bug

by drewfustini on Mon Aug 08, 2016 1:31 pm

I've not seen this issue before. Are you able to individually set the frequency to 625 Hz, with out the loop?

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: BBI0 PWM Bug

by alarm on Mon Aug 08, 2016 2:45 pm

yes, I can manage the frequency of 625Hz.
If I swap the frequency of 78Hz with the 625Hz frequency, I have the same problem with the frequency of 78Hz.

alarm
 
Posts: 4
Joined: Sun Aug 07, 2016 11:17 am

Re: BBI0 PWM Bug

by drewfustini on Tue Aug 09, 2016 12:10 am

There is a new pull request by MatthewWest on Github that add support for Linux 4.1 kernel to Adafruit_BBIO:
https://github.com/adafruit/adafruit-be ... n/pull/108

I've yet to test this with different versions of Debian images, but you may want to try this with the latest Debian Jessie image:
http://beagleboard.org/latest-images

Here is the branch to try:
https://github.com/MatthewWest/adafruit ... ts/develop

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: BBI0 PWM Bug

by alarm on Tue Aug 09, 2016 10:17 am

So I installed the latest version of debian jessie to the BBB:

Distributor ID: Debian
Description: Debian GNU / Linux 8.4 (jessie)
Release: 8.4
Codename: jessie

I cloned the branch:
https://github.com/MatthewWest/adafruit ... ts/develop

I did the installation for python3.

When I run my script, I receive the following error message:

File "cycle_pwm_1.py", line 8, in <module>
PWM.start (freq_var_pin, 0.50)
RuntimeError: Problem with a sysfs file

What to do ?

alarm
 
Posts: 4
Joined: Sun Aug 07, 2016 11:17 am

Re: BBI0 PWM Bug

by alarm on Tue Aug 09, 2016 11:50 am

I solved my problem by making the following operation:

I removed the # in the following line in the file /boot/uEnv.txt

#Bone_capemgr.enable_partno=

then reboot

I handed the #

then reboot again

I have no error message.

I can generate the 6 frequencies.

Do you think the cause is related to the command line?

Thank you for your help

alarm
 
Posts: 4
Joined: Sun Aug 07, 2016 11:17 am

Re: BBI0 PWM Bug

by drewfustini on Fri Aug 12, 2016 7:30 pm

Please try out Matthew West's develop branch. He has several more fixes in it now:
https://github.com/MatthewWest/adafruit ... ts/develop

I tested it out ok with all the BeagleBone SD card images that I have.

The pull request should be merged into the Adafruit repo soon.

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.