Here I was trying to use this library for the Coral EdgeTPU board, I'm having such difficulty to get the PWM to work. I have post a question here.
Here is my testing code:
from periphery import PWM
import time
# Open PWM channel 0, pin 0
pwm = PWM(0,0)
# Set frequency to 1 kHz
pwm.frequency = 50
# Set duty cycle to 75%
pwm.duty_cycle = 0.02
pwm.enable()
print(pwm.period)
print(pwm.frequency)
print(pwm.enabled)
# Change duty cycle to 50%
pwm.duty_cycle = 0.05
pwm.close()
Problem is this part:
# Open PWM channel 0, pin 0
pwm = PWM(0,0)
I can see output when running PWM(0,0)PWM(0,1)PWM(0,2)
but I get the error messsage when trying to run the following:
PWM(1,1)
PWM(2,2)
mendel@elusive-jet:/sys/class/pwm$ sudo python3 /usr/lib/python3/dist-packages/edgetpuvision/testPWM.py
OSError: [Errno 19] No such device
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/periphery/pwm.py", line 69, in _open
f_export.write("%d\n" % pin)
OSError: [Errno 19] No such device
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/edgetpuvision/testPWM.py", line 5, in <module>
pwm = PWM(1,1)
File "/usr/local/lib/python3.5/dist-packages/periphery/pwm.py", line 44, in __init__
self._open(channel, pin)
File "/usr/local/lib/python3.5/dist-packages/periphery/pwm.py", line 71, in _open
raise PWMError(e.errno, "Exporting PWM pin: " + e.strerror)
periphery.pwm.PWMError: [Errno 19] Exporting PWM pin: No such device
Here I was trying to use this library for the Coral EdgeTPU board, I'm having such difficulty to get the PWM to work. I have post a question here.
Here is my testing code:
Problem is this part:
I can see output when running
PWM(0,0)
PWM(0,1)
PWM(0,2)
but I get the error messsage when trying to run the following:
PWM(1,1)
PWM(2,2)
Based off the document from both Coral and the library site: https://coral.withgoogle.com/tutorials/devboard-gpio/
https://github.com/vsergeev/python-periphery
The
PWM(1,1)
PWM(2,2)
should have worked without issue, I can see the following directories existed:
In the python-periphery source code https://github.com/vsergeev/python-periphery/blob/master/periphery/pwm.py
it should getting the path as following:
PWM(1,1) ===> /sys/class/pwm/pwmchip1/pwm1
ifpwm1
not exists, then it should call theexport
to generate it.So, My main question are:
channel
andpin
and how it is been used ?Thank you in advance.