I need a fairly deterministic PWM duty cycle. I don't believe it's rocket science to use hardware PWM. Numerous sources tell us that we can modify /boot/config.txt by adding
dtoverlay=pwm-2chan
which defaults to PWM0 = GPIO18 and PWM1 = GPIO19. We also know that we can use
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
to set PWM0 = GPIO12 and PWM1 = GPIO13.
My application has been using software PWM and coincidentally I've elected GPIO13 for this. So it should be quite easy to switch to hardware. GPIO 12, 18, and 19 are already allocated to other functions on a little "hat" I produced, which would be a real pig to modify.
The latter above allows my test code to work, but I am concerned that it will also convert GPIO12 to PWM.
I thought I might be able to use
dtoverlay=pwm,pin=13,func=4
in order to use GPIO13 as PWM1, leaving the other IOs available for normal GPIO, but the pin doesn't seem to produce any output when used in conjunction with the library at [https://pypi.org/project/rpi-hardware-pwm/][1] .
Can you tell me if what I'm trying to achieve is possible, and if I'm going about it the right way? What could I do differently to get a result?
My hardware is B+ v1.2 and my preference is to work in Python. [1]: https://pypi.org/project/rpi-hardware-pwm/
Thanks.