Wiki

This version (12 Feb 2021 13:34) was approved by Andrei Drimbarean.

AD5791 - No-OS Driver

Supported Devices

Overview

The AD5791 is a single 20-bit, unbuffered voltage-output digital-to-analog converter (DAC) that operates from a bipolar supply of up to 33 V. It accepts a positive reference input in the range 5 V to VDD − 2.5 V and a negative reference input in the range VSS + 2.5 V to 0 V.

The AD5791 offers a relative accuracy specification of ±1 LSB max, and operation is guaranteed monotonic with a ±1 LSB differential nonlinearity (DNL) maximum specification.

The device uses a versatile 3-wire serial interface that operates at clock rates up to 35 MHz and that is compatible with standard serial peripheral interface (SPI), QSPI™, MICROWIRE™, and DSP interface standards. The device incorporates a power-on reset circuit that ensures the DAC output powers up to 0 V and in a known output impedance state and remains in this state until a valid write to the device takes place.

Applications:

  • Medical instrumentation
  • Test and measurement
  • Industrial control
  • High end scientific and aerospace instrumentation

Driver Description

Functions Declarations

Function Description
int32_t ad5791_init(struct ad5791_dev **device,
                             struct ad5791_init_param init_param);
Initializes the communication with the device.
int32_t ad5791_remove(struct ad5791_dev *dev);
Free the resources allocated by ad5791_init().
int32_t ad5791_set_register_value(struct ad5791_dev *dev,
                                           uint8_t register_address,
                                           uint32_t register_value);
Writes data into a register.
int32_t ad5791_get_register_value(struct ad5791_dev *dev,
                                           uint8_t addr,
                                           uint32_t *value);
Get register value standard function.
int32_t ad5791_dac_ouput_state(struct ad5791_dev *dev,
                                        uint8_t state);
Sets the DAC output in one of the three states.
int32_t ad5791_set_dac_value(struct ad5791_dev *dev,
                                      uint32_t value);
Writes to the DAC register.
int32_t ad5791_soft_instruction(struct ad5791_dev *dev,
                                         uint8_t instruction_bit);
Asserts RESET, CLR or LDAC in a software manner.
int32_t ad5791_setup(struct ad5791_dev *dev,
                              uint32_t setup_word);
Configures the output amplifier, DAC coding, SDO state and the linearity error compensation.

Types Declarations

/* Supported devices */
enum ad5791_type {
	ID_AD5760,
	ID_AD5780,
	ID_AD5781,
	ID_AD5790,
	ID_AD5791
};
 
struct ad5791_chip_info {
	uint32_t resolution;
};
 
struct ad5791_dev {
	/* SPI */
	spi_desc		*spi_desc;
	/* GPIO */
	struct gpio_desc	*gpio_reset;
	struct gpio_desc	*gpio_clr;
	struct gpio_desc	*gpio_ldac;
	/* Device Settings */
	enum ad5791_type act_device;
};
 
struct ad5791_init_param {
	/* SPI */
	spi_init_param	spi_init;
	/* GPIO */
	struct gpio_init_param		gpio_reset;
	struct gpio_init_param		gpio_clr;
	struct gpio_init_param		gpio_ldac;
	/* Device Settings */
	enum ad5791_type act_device;
};

Downloads

resources/tools-software/uc-drivers/ad5791.txt · Last modified: 12 Feb 2021 10:07 by Andrei Drimbarean