I’ve investigated a bit more.  First, and I should have done this sooner, I 
removed all the capes I’m using and tested the bare Beaglebone black.  Success, 
all four PWMs work.

Then I began adding capes one at a time.  I found that when a Prototype Cape is 
used, PWM is no longer available on P8_13.  To be absolutely certain, I 
connected a brand new out of the box GHI Prototype Cape.  No PWM on P8_13.  
Remove the cape and PWM works.  

If I connect a Power Cape, PWM works, this would seem to rule out a bad solder 
joint or something physical on the BBB.    

There is nothing near P8_13 on any of these capes, yet something is affecting 
that pin.  

Is there something in the device tree that allows the cape to grab one of the 
PWM devices, perhaps for the variable LED that’s on the cape?

Any other ideas what would cause this?

Thanks,
-Steve



> On Jan 15, 2021, at 10:54 AM, Steve Lentz <[email protected]> wrote:
> 
> Robert:
> 
> Thanks.  
> 
> Still returns an error
> 
> debian@beaglebone:/sys/class/pwm/pwm-7:1$ sudo sh -c "echo '400000' >> 
> ./period"
> [sudo] password for debian:
> sh: 1: echo: echo: I/O error
> debian@beaglebone:/sys/class/pwm/pwm-7:1$ cat period
> 500000
> 
> I can live with 2000 Hz, I’m just curious as to why this seems to be the only 
> allowed value for PWM frequency.  Is this intentional or is something missing 
> from the PWM driver?
> 
> Adafruit’s library does some odd things, for example the following results in 
> a 2000 Hz signal with 80% duty cycle:
> 
> >>> import Adafruit_BBIO.PWM as PWM
> >>> pin3 = "P8_19"
> >>> PWM.start(pin3, 25)
> >>> PWM.set_frequency(pin3,1000)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> RuntimeError: Could not write to the frequency file
> >>> PWM.set_duty_cycle(pin3,40)
> 
> The error makes it clear 2000 Hz was not accepted, but Python carries on 
> thinking base frequency is now 1000 Hz and sets the duration of signal high 
> accordingly.
> 
> At least people should be aware of this if they try to use it.  
> 
> -Steve
> 
> 
>> On Jan 15, 2021, at 10:34 AM, Robert Nelson <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> On Fri, Jan 15, 2021 at 9:25 AM Steve Lentz <[email protected] 
>> <mailto:[email protected]>> wrote:
>>> 
>>> OK, 3 of 4 PWM pins are working, but still no luck with P8_13.
>>> 
>>> I can see that Adafruit_BBIO is writing values into 
>>> /sys/class/pwm/pwm-7:1/duty_cycle but no output is being generated.
>>> 
>>> debian@beaglebone:/sys/class/pwm/pwm-7:1$ cat duty_cycle
>>> 200000
>>> debian@beaglebone:/sys/class/pwm/pwm-7:1$ cat period
>>> 500000
>>> 
>>> Pin 8_13 can still be used for GPIO.  I have not dug further into the 
>>> device files. Does this seem like a hardware or software issue?  Should I 
>>> reinstall the base image, accept that the board is flaky, or is there some 
>>> other possible solution?
>>> 
>>> Also, the PWM frequency is fixed at 2000 Hz (period = 500000 ns).  Is this 
>>> intended?  I can work with 2000, so this is more out of curiosity.
>>> 
>>> Python returns the following errors:
>>> 
>>>>>> PWM.start(pin3,50,1000)
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in <module>
>>> RuntimeError: Problem with a sysfs file
>>> 
>>>>>> PWM.set_frequency(pin3,1000)
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in <module>
>>> RuntimeError: Could not write to the frequency file
>>> 
>>> Attempting to write into the period file directly returns the following:
>>> 
>>> debian@beaglebone:/sys/class/pwm/pwm-7:1$ sudo echo 400000 > period
>>> [sudo] password for debian:
>>> echo: write error: Invalid argument
>> 
>> That's invalid, "sudo echo....."
>> 
>> sudo sh -c "echo '400000' >> ./period"
>> 
>> Besides, pwm should be "root:gpio" permissoins..
>> 
>> Regards,
>> 
>> 
>> --
>> Robert Nelson
>> https://rcn-ee.com/ <https://rcn-ee.com/>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/58A77F3B-CD0F-42CD-80D4-CDFE3149263B%40gmail.com.

Reply via email to