Linux-PWM Archive mirror
 help / color / mirror / Atom feed
From: Patrick Menschel <menschel.p@posteo.de>
To: linux-pwm <linux-pwm@vger.kernel.org>
Subject: [PCA9685] Possible bug in PCA9685 driver
Date: Wed, 27 Dec 2023 12:20:16 +0000	[thread overview]
Message-ID: <e91c4495-c32f-9de1-6f48-af16239bc3b6@posteo.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1196 bytes --]

Hello,

I'd like to report a possible bug in the pca9865 driver.

https://github.com/raspberrypi/linux/blob/rpi-6.1.y/drivers/pwm/pwm-pca9685.c

The resulting frequency is 10% off.

I'm currently using an adafruit pca9685 board to zero-in some servos via 
SYSFS.

As always, first attempt was a disaster but after that, I started to 
measure things with a Benning MM 7-1 and when I set the period to 20ms 
via SysFs, I read 55Hz on the multimeter.

I had to set the period to 22ms to get 49,88Hz.

```
$ cd /sys/class/pwm/pwmchip0/
$ echo 0 > export
$ cd pwm0/

$ echo 20000000 > period
$ echo 11000000 > duty_cycle
$ echo 1 > enable
# results in ~55Hz

$ echo 0 > enable
$ echo 22000000 > period
$ echo 11000000 > duty_cycle
$ echo 1 > enable
# results in ~50Hz, and it's 50% duty cycle to get a symetric signal


$ echo 0 > enable
# after connecting a servo and setting duty to 1-2ms everything works as 
expected.
$ echo 1 > enable
$ echo 1000000 > duty_cycle
$ echo 1500000 > duty_cycle
$ echo 2000000 > duty_cycle
```
In the end it does not matter to the servo or the application and I'm 
not sure if I measured correctly.

BR
Patrick Menschel

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

                 reply	other threads:[~2023-12-27 12:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e91c4495-c32f-9de1-6f48-af16239bc3b6@posteo.de \
    --to=menschel.p@posteo.de \
    --cc=linux-pwm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).