Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PCA9685 wrong initialisation #1020

Closed
gen2thomas opened this issue Oct 28, 2023 · 2 comments
Closed

PCA9685 wrong initialisation #1020

gen2thomas opened this issue Oct 28, 2023 · 2 comments
Assignees

Comments

@gen2thomas
Copy link
Collaborator

gen2thomas commented Oct 28, 2023

according to datasheet section "7.3.1.1 Restart mode" the RESET bit must be set after going out of sleep mode (the default) and wait > 500us

adafruit_driver.go

  • the sleep bit was reset once with set all other bits to the default --> OK
  • wait 5ms --> OK
  • reset all bits in MODE1 register by old-state & 0x10, because old-state has sleep unset before, this leads to unset the ALLCALL bit, which was set before by intention
  • wait 5ms, but no RESET bit is set --> NOK

pca9685_driver.go

  • the sleep bit was reset once with set all other bits to the default --> OK
  • wait 5ms --> OK
  • the sleep bit is reset again, but not the RESET bit --> NOK

additionally for setting prescaler

  • pca9685_driver.go: wrong comment for restore the old mode (e.g. set AI), but just the old value is restored, without knowledge of its content
  • adafruit_driver.go: do not set the register before read to MODE1 explicitly

note: the software reset (SWRST) is not the same as setting the RESET bit, it is setting a reserved address by the I2C bus controller

@gen2thomas gen2thomas self-assigned this Oct 28, 2023
@gen2thomas
Copy link
Collaborator Author

I'm trying to fix this together with #1010

@gen2thomas gen2thomas added bug enhancement done on dev the feature or bug is solved on dev branch and wait for merge to release branch labels Oct 29, 2023
@gen2thomas
Copy link
Collaborator Author

available since v2.2.0

@gen2thomas gen2thomas removed the done on dev the feature or bug is solved on dev branch and wait for merge to release branch label Oct 30, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant