I am working on a project and I need an AD7768-1 library to make this analog-digital-converter talk to my Arduino using SPI. " The AD7768-1" doesn't exist in Arduino's library. Thanks in advance.

  • There doesn't seem to be a ready to use Arduino library for this part. Though I found one for AD7705/6. If the parts are similar enough you might be able to make this library work with AD7768 with only few changes. Also AnalogDevices provides a no-OS code (general code for devices without an OS like microcontrollers), though you would need to find out how to use it and how to provide it with its needed SPI hardware routines. And depending on your project it might be easier to just write your own SPI code for it without a thirdparty library
    – chrisl
    Feb 23, 2023 at 14:11
  • please add a clear, answerable question to your post
    – jsotola
    Feb 26, 2023 at 18:41

1 Answer 1


At present, there is no Arduino library available for this device. As suggested by @chrisl, the easiest way to proceed would be to develop your own driver. However, if you wish to leverage all the advanced features of the device, you could use the drivers provided by Analog Devices. The AD7768-1 differs significantly from the AD7705/6!!!. Having personally interfaced with this device (and AD7768/AD7768-4) using STM32 microcontrollers and Xilinx FPGAs, I would recommend using the no-OS drivers provided by Analog Devices. This approach has worked well for me using an STM32:

  1. Please read this article first: Understanding and Using the No-OS and Platform Drivers.
  2. And this one:No-OS Overview.
  3. Gather all the necessary files you would need from the Analog Devices Github repository no-OS:
  4. Get AD7768-1 drivers from the "/drivers" folder.
  5. Get Platform Drivers from "drivers/platform/". Since we are using STM32, then pick one of these three (STM32, MBED or Generic):/STM32: suitable for STM32CubeIDE or similar. I will use this one. MBED: for MBED platforms. Check this out AD7768-1 IIO Application. Generic: With this one, you need to fill-in platform peripheral calls manually (in the case of Arduino platforms, this would be something like SPI.beginTransaction, etc.). All the associated source and header files are available in the same repository. To simplify, I would assume you are using STM32CubeIDE and you just want to configure and read data from the device. Then,
  6. Configure the STM32 Microcontroller as an SPI Master-Full-Duplex MODE 3 [MOSI, MISO, CLK].
  7. Slave select PIN software-controlled [SS].
  8. [Optional] One Pin for data-ready interrupts [DRDY].
  9. Place the required source and header files in their respective folders. At a minimum, you need (ad77681.c/h, no_os_spi.c, stm32_spi.c, no_os_gpio.c, stm32_gpio.c) and all their linked header files.
  10. Initialize No-OS drivers and platform drivers. It would be something like this:
struct stm32_spi_init_param stm32_init = {
      .chip_select_port = 1,
      .get_input_clock = &HAL_RCC_GetPCLK1Freq

struct no_os_spi_init_param spi_init_param = {
      .device_id = 1,
      .max_speed_hz = 64000000,
      .chip_select = 6,
      .mode = NO_OS_SPI_MODE_3,
      .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST,
      .platform_ops = &stm32_spi_ops,
      .extra = &stm32_init ,
      .parent = NULL

 struct ad77681_init_param ad77681_init = {
      .spi_eng_dev_init = spi_init_param,
      .power_mode = AD77681_MEDIAN,
      .mclk_div = AD77681_MCLK_DIV_8,
      .conv_mode = AD77681_CONV_CONTINUOUS,
      .diag_mux_sel = AD77681_AIN_SHORT,
      .conv_diag_sel = false,
      .conv_len = AD77681_CONV_24BIT,
      .crc_sel = AD77681_NO_CRC,
      .status_bit = 0,
      .VCM_out = AD77681_VCM_2_05V,
      .AINn = AD77681_AINn_ENABLED,
      .AINp = AD77681_AINp_ENABLED,
      .REFn = AD77681_BUFn_ENABLED,
      .REFp = AD77681_BUFp_ENABLED,
      .filter = AD77681_SINC5,
      .decimate = AD77681_SINC5_FIR_DECx32,
      .sinc3_osr = 0,
      .vref = AD77681_VOLTAGE_REF,
      .mclk = AD77681_MCLK,
      .sample_rate = AD77681_DEFAULT_SAMPLING_FREQ,
      .data_frame_byte = AD77681_DECIMATION_RATE,

Finally setup the Device like this:

struct ad77681_dev *device = NULL;
struct ad77681_status_registers *status = NULL;
int32_t init_status = ad77681_setup(&device, ad77681_init, &status);

If the init_status is 0 then you’ve successfully initialized the device!! You would read data like this:

ad77681_spi_read_adc_data(device, data_buffer, AD77681_REGISTER_DATA_READ);

I hope this is helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.