beagleboard/librobotcontrol

pwm driver in latest Debian image

Opened this issue · 0 comments

After updating my BeagleBone Blue from Debian 9.5 to Debian 9.9 2019-08-03 4GB SD IoT, rc_pwm_init() fails for any frequency except 50 Hz. For example, I've tried 40 Hz, 60 Hz, 100 Hz and 200 Hz. The program worked under Debian 9.5 for 200 Hz, but doesn't work under Debian 9.9. The following code:

if (rc_pwm_init(0, servo_hz) != 0) { // initialize PWM subsystem 0 (SPI header)
fprintf(stderr, "ERROR: failed to initialize PWM SS 0\n");

gives the following error messages:

ERROR in rc_pwm_init, failed to write to channel A period fd: Invalid argument
ERROR: failed to initialize PWM SS 0

Is this a driver issue? In pwm.c, I find the following comments:
// The ti pwm driver has gone through several revisions and it presents devices
// in the file system differently every version. For example, subsytem 2 channel A
// showed up as the following files:
// in 4.9: /sys/class/pwm/pwmchip4/pwm0/
// in 4.14.54-ti-r63: /sys/class/pwm/pwm-4:0/
// in 4.14.61-ti-r68: /sys/class/pwm/pwm-7:0/
// depending on kernel, mode is set to 0 or 1 on export, index is used for 4.14

I am currently running:
Kernel: 4.14.108-ti-r113
BeagleBoard.org Debian Image 2019-08-03
Debian: 9.9
Currently running on a:
MODEL_BB_BLUE
Robot Control library Version:
1.0.4
rc_servo_pwm.docx

Is there a fix for Debian 9.9 or do I need to revert to an older version?

(I just verified that it does work for Debian 9.5.)