#dac #embedded-hal-driver #spi-interface #embedded-hal #driver #digital-signal #8564

no-std dac8564

A simple platform agnostic library for the Texas Instruments DAC8564

5 releases

0.1.0 Feb 27, 2021
0.0.5 Jul 15, 2024
0.0.4 Feb 27, 2022
0.0.3 May 19, 2021
0.0.2 Feb 28, 2021

#646 in Embedded development

MIT license

8KB
102 lines

dac8564

A platform agnostic library for the Texas Instruments DAC8564.

dac8564

description

The DAC8564 is a low-power, voltage-output, four-channel, 16-bit digital-to-analog converter (DAC). The device includes a 2.5V, 2ppm/°C internal, reference (enabled by default), giving a full-scale output voltage range of 2.5V. The internal reference has an initial accuracy of 0.004% and can source up to 20mA at the VREFH/VREFOUT pin. The device is monotonic, provides very good linearity, and minimizes undesired code-to-code transient voltages (glitch). The DAC8564 uses a versatile 3-wire serial interface that operates at clock rates up to 50MHz. The interface is compatible with standard SPI™, QSPI™, Microwire™, and digital signal processor (DSP) interfaces.

features

example

Note: Example based on the stm32h7xx-hal.

fn main() -> ! {
    // SPI interface pins
    let sck = sck.into_alternate_af5();
    let mosi = mosi.into_alternate_af5();
    // Control lines
    let ldac = ldac.into_push_pull_output();
    let enable = enable.into_push_pull_output();
    let nss = nss.into_push_pull_output();
    // Initialize SPI
    let spi: Spi<SPI2, Enabled> = interface.spi(
        (sck, NoMiso, mosi),
        spi::MODE_0,
        20.mhz(),
        prec,
        clocks,
    );
    // Initialize the struct
    let mut dac = dac8564::Dac::new(spi, nss, ldac, enable);
    // Enable the DAC8564
    dac.enable();
    // Blocking call. Set value to 1000 on the DAC
    dac.write(Channel::A, 1000).unwrap();
}

contributing

I am not actively using the DAC8564 chip in any of my current prototypes. For this reason development, features and bug fixes could be slow, but I am fully open to any contribution. Please create a PR if you have any changes 🙏🏼

Dependencies

~71KB