Skip to content

Add NXP PCA9685 16-channel 12-bit PWM I2C driver#452

Open
benzaid32 wants to merge 1 commit into
atopile:mainfrom
benzaid32:add-nxp-pca9685
Open

Add NXP PCA9685 16-channel 12-bit PWM I2C driver#452
benzaid32 wants to merge 1 commit into
atopile:mainfrom
benzaid32:add-nxp-pca9685

Conversation

@benzaid32

Copy link
Copy Markdown

Adds a package for the NXP PCA9685, 16-channel 12-bit PWM I2C LED/servo
driver. This is the chip behind the Adafruit 16-channel PWM/Servo breakout,
so it's a pretty common request for anything that drives multiple hobby
servos or needs more PWM channels than the MCU can offer.

Part used: PCA9685PW,118, TSSOP-28, LCSC C2678753.

What the module exposes

  • power (ElectricPower, 2.3V-5.5V, asserted in the module)
  • i2c (I2C, default address 0x40 - matches the Adafruit breakout)
  • output_enable (ElectricLogic, active-low OE)
  • extclk (ElectricSignal, optional external clock)
  • led[0:15] (16 ElectricLogic PWM outputs)

Design choices worth calling out

  • 10k pull-up on nOE, so outputs default to disabled on power-up. Safer
    for servos than leaving them live while the MCU is still booting.
  • 100k pull-down on EXTCLK so the pin isn't floating when the internal
    25MHz oscillator is being used.
  • 4.7k I2C pull-ups (Fm+ compatible at 3.3V / 5V).
  • 100nF + 10uF decoupling, because 16 outputs switching in phase pulls a
    noticeable current spike.
  • 6-bit Addressor on A5:A4:A3:A2:A1:A0 so you can stack up to 62 of
    these on a single bus.

Build status

  • ato build passes (default target).
  • ato build usage passes (usage example target).
  • Tested locally on atopile 0.15.6.
  • Only warning during build is LCSC redirecting the datasheet URL to HTML
    instead of a PDF. This happens to several other packages in the repo
    too (it's an LCSC infra quirk, not a code issue).

Notes

  • Structure mirrors microchip-mcp23017 and ti-tca9548a: typed
    interfaces, auto-generated parts from ato create part -s C2678753 -a,
    default + usage build targets, MIT license.
  • The datasheet names OE active-low (/OE). EasyEDA exports it as OE
    with overbar. The auto-generated part file names the pin nOE and the
    module wires package.nOE to the output_enable interface.

Tested against

NXP datasheet Rev. 4 (16 April 2015). All 28 pin-to-signal mappings
produced by ato create part match the datasheet's Table 3 "Pin
description" for TSSOP-28.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant