Open pdp7 opened 4 years ago
@makermelissa please assign to me
For example on the BeagleBone Black, there is
/sys/class/pwm/pwmchip0/
/sys/class/pwm/pwmchip1/
/sys/class/pwm/pwmchip3/
/sys/class/pwm/pwmchip4/
/sys/class/pwm/pwmchip6/
/sys/class/pwm/pwmchip7/
But the pin they point to can change between boots.
Whereas, these mappings in /dev/pwm will not change between boot:
/dev/pwm/ecap1
/dev/pwm/ecap2
/dev/pwm/ehrpwm0a
/dev/pwm/ehrpwm0b
/dev/pwm/ehrpwm1a
/dev/pwm/ehrpwm1b
/dev/pwm/ehrpwm2a
/dev/pwm/ehrpwm2b
After discussing with @RobertCNelson, I have learned that pwmchip numbering in Linux is not deterministic. Therefore, the mapping between a pin and the pwm chip/channel can change between boots:
This is not a Beagle/AM3358 specific issue. This is an issue effecting in the PWM subsystem in Linux kernel.
The BeagleBoard.org Debian image that @RobertCNelson builds solves this by creating deterministic symlinks using udev rules: https://github.com/rcn-ee/repos/blob/master/bb-customizations/suite/stretch/debian/81-pwm-noroot.rules
I need to modfiy
src/adafruit_blinka/microcontroller/am335x/sysfs_pwmout.py
so that it uses these deterministic /dev/pwm entries in order for there the correct mapping between the P8/P9 pin and the corresponding peripheral.Furthermore, the EHRPWM blocks contain a and b outputs. These can have independent duty cycles but must have the same frequency. I need to represent that tight coupling in the code. Attempting to set EHRPWM0A and EHRPWM0B to different frequencies will fail.