This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DAC81416: Linux device driver requirement

Part Number: DAC81416
Other Parts Discussed in Thread: DAC81401

Tool/software:

Hi

We are using DAC81416 Digital to analog IC in one of our designs. We are not able to locate the Linux device driver for DAC81416. Please can you help us with the right device driver or any reference.

Thank you 

  • Hi Srinath,

    Unfortunately, we do not offer a linux driver for that device.  We do have a python example for a device in that family, the DAC81401, which you could reference as a starting point for developing a interface.

    DAC81401 data sheet, product information and support | TI.com

    Thanks,

    Paul

  • Hi Paul,

    Thank you, Paul, for your support just need to ask a short question in that are providing any Linux driver for testing you for this DAC81416 any family is also fine just for reference i am asking. If any availability is there, please guide us.

    Thank You 

  • Hi Srinath,

    We do not have any linux drivers for any device in this family. This device uses a simple SPI interface. You can likely find SPI Linux driver examples online. If you have questions about SPI on this device, or about configuring the register settings for your application, we can help with those specific questions.

    Best,

    Katlynne Jones

  • Hi Katlynne,

    We tried to communicate with DAC81416 over SPI with SOM imx8qm board,

    We written an application to communicate with DAC through SPI.

    #include <stdio.h>

    #include <stdlib.h>

    #include <stdint.h>

    #include <fcntl.h>

    #include <unistd.h>

    #include <sys/ioctl.h>

    #include <linux/spi/spidev.h>

     

    #define SPI_DEV_PATH "/dev/spidev0.0"  // Adjust this path as necessary

     

    // Function to initialize SPI

    int init_spi(const char *device) {

        int fd = open(device, O_RDWR);

        if (fd < 0) {

            perror("Failed to open SPI device");

            exit(EXIT_FAILURE);

        }

     

        // Set SPI mode

        uint8_t mode = SPI_MODE_0;

        if (ioctl(fd, SPI_IOC_WR_MODE, &mode) < 0) {

            perror("Failed to set SPI mode");

            close(fd);

            exit(EXIT_FAILURE);

        }

     

        // Set SPI max speed

        uint32_t speed = 500000; // 500 kHz

        if (ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed) < 0) {

            perror("Failed to set SPI speed");

            close(fd);

            exit(EXIT_FAILURE);

        }

     

        return fd;

    }

     

    // Function to send 16-bit data via SPI

    void spi_transfer(int fd, uint8_t *data, size_t length) {

        struct spi_ioc_transfer spi_msg = {

            .tx_buf = (unsigned long)data,  // Cast the pointer to unsigned long or __u64

            .rx_buf = 0,                    // No receive buffer (set to 0 if not used)

            .len = length,                  // The length of the data

            .speed_hz = 500000,             // SPI clock speed in Hz

            .bits_per_word = 8,             // Bits per word (8 is typical)

            .delay_usecs = 0,               // Delay between transfers (optional)

            .cs_change = 0,                 // Chip select behavior (0 = don't change after transfer)

        };

     

        // Send SPI message

        if (ioctl(fd, SPI_IOC_MESSAGE(1), &spi_msg) < 0) {

            perror("Failed to send SPI message");

            close(fd);

            exit(EXIT_FAILURE);

        }

    }

     

    int main() {

        int spi_fd = init_spi(SPI_DEV_PATH);

     

        // Command 1: Configure SPI_CONFIG register

        uint8_t config_data[3] = {0x03, 0x0A, 0x84};  // actual config data

        spi_transfer(spi_fd, config_data, sizeof(config_data));

     

        // Command 2: Set Channel 0 value

        uint8_t channel_0_data[3] = {0x09, 0xFF, 0xFE};  //  actual channel 0 data

        spi_transfer(spi_fd, channel_0_data, sizeof(channel_0_data));

     

        // Command 3

        uint8_t command_3_data[3] = {0x10, 0xFF, 0xFF};  // actual command 3 data

        spi_transfer(spi_fd, command_3_data, sizeof(command_3_data));

     

        // Close the SPI device

        close(spi_fd);

        return 0;

    }

    We are trying to send the voltage on channel 0 means DAC0,

    We are sending the commands to set

    1. SPI Configuration command - 0x03, 0x0A84

    2. Channel 0 we need make it power down to use that channel for that we are sending command - 0x09, 0xFFFE

    3. DAC0, we need to send the voltage is 5V, command - 0x10, 0xFFFF

    Could you please guide us through this program, if any changes or modification required, please inform us.

    Thanks

    Srinath Rao.

  • Hi Srinath,

    Thanks for sharing your code. Sanjay will review and provide some suggestions. Are you able to capture a SPI write frame on a scope or logic analyzer? If so, please share so we can verify that the correct SPI format and timings are being used. 

    Best,

    Katlynne Jones 

  • Hi Srinath,

     
    Please use following set SPI writes to get the DAC VOUT voltages for a channel - 

    a) Write 0x0A84 in SPICONFIG (0x03) -  to power-up the DAC81416 device 

    b) Write 0x3F00 in GENCONFIG (0x04) - if you are using internal reference

    c) Write 0x0000 in DACPWDN (0x09) - to power-up the individual DAC channels

    d) Write 0xFFFF in DACn_DATA (n = 0x10 to 0x1F) -  to configure the individual DAC channel outputs to 5 V 
     

    Also make sure that power supplies are as per data sheet recommendations.

     

    Thanks,
    Sanjay

  • Hi Sanjay,

    I have started implementing these points you provided. If any issue will be there will let you know 

    Thanks,

    Srinath