adafruit / adafruit/Adafruit_CircuitPython_MCP4728

synchronous update via LDAC pin does not work

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
8
PR merge metrics
No merged PRs in 30d

Description

**Problem:**
Attempting to latch the outputs VA-VD via LDAC does not work.
Outputs are updated immediately, regardless of the state of the LDAC pins.
More info and tests were reported at:
https://forums.adafruit.com/viewtopic.php?t=198312
https://forums.adafruit.com/viewtopic.php?t=199196

**Analysis and findings:**
The UDAC-bit is hard coded to "0" at every I2C write command.
adafruit_mcp4728.py line 224:
` write_command_byte = 0b01000000 # 0 1 0 0 0 DAC1 DAC0 UDAC`

**suggested solution:**
a) hard code UDAC-bit to "1"
adafruit_mcp4728.py line 224:
` write_command_byte = 0b01000001 # 0 1 0 0 1 DAC1 DAC0 UDAC`
and use LDAC-Pin to control the output ports
LDAC = True # output ports are locked (no updates)
LDAC = False # output ports are updated immediately
advantage: fast and easy to implement
disadvantage: hardcoded solution, ports cannot be controlled individually.

or

b) implement a function to control UDAC bit(s)
advantage: each port can be controlled individually
disadvantage: only one port can be selected at a time, but not all together!

**suggested Enhancements (nice to have):**
a) implement "Fast Write command" to write DAC Input Registers Sequentially from Channel A to D
b) implement "Multi-Write command" to write Multiple DAC Input Registers
c) implement faster clock speeds (400kHz, 1MHz, 3.4MHz), maybe as in busio.I2C

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with adafruit_mcp4728.py at line 224 and review the reported MCP4728 LDAC/UDAC behavior in the linked forum tests. Confirm the expected latch behavior and decide whether the hard-coded or per-channel approach is required; done means the selected behavior is implemented and verified against those tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.