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.

DAC81416EVM: DAC Configuration & DAC Out

Part Number: DAC81416EVM
Other Parts Discussed in Thread: DAC81416

DAC81416: Configuration added here

I used reference code. Send and receive through SPI interface okay.

but problem is send data not getting on DAC out pins.

Please can any one help.

void Dac_Config(void)

{

GPIO_WritePin(DAC_RESETn, CLEAR);
/* Delay for a bit */
DELAY_US(1000); // 1msec
GPIO_WritePin(DAC_RESETn, SET);


/* DACRANGEn Register A Range: +/- 20V */
dac_init_steps(0x0acccc);
dac_init_steps(0); /* Receive bytes */
/* DACRANGEn Register B Range: +/- 20V */
dac_init_steps(0x0bcccc); 
dac_init_steps(0); /*Receive bytes */
/* DACRANGEn Register C Range: +/- 20V */
dac_init_steps(0x0ccccc); 
dac_init_steps(0); /* Receive bytes */
/* DACRANGEn Register D Range: +/- 20V */
dac_init_steps(0x0dcccc);
dac_init_steps(0); /* Receive bytes */


/* Power-up device */
dac_init_steps(0x030a84);
/* Power up all channels */
dac_init_steps(0x090000);
/* Enable Broadcast for all channels */
dac_init_steps(0x05ffff);
/* Write code to all channels */
dac_init_steps(0x0fffff);

}

Then sending continues 

void loop(void)

{

dacWrite(0x7fff);

/* Delay for a bit */
DELAY_US(1000);// 1msec req

dacWrite(0xffff);

}

When i am trying to read DEVISE ID and version MISO signal is disturbed.

Note: LDAC and CLR not used.

Giving input supplies 

J7.3 ---- GND

J7.4-----VIO-----5V

J7.5-----VDD/VAA-----5V

J7.6 -----VSS-------GND

J7.7-------VCC------30V

  • Hi,

    When you say send and receive through SPI interface is OKAY, register read/write is working fine?

    Can you please share the scope shots of your SPI frame for one of your write register?

    Also

  • Dear Akhilesh,

    Please find the attached Graphs

    Read Register:

    Write Register:

  • Hi Madhusudan,

    Thanks for the scope image but still CS signal missing in your capture. DAC code will update  rising edge of CS signal. 

    Also, SYNC-EN bit must set to 0.

    Please share SPI capture with CS signal and ensure SYNC-EN bit set to 0.

     

  • Dear Anbu Mani35,

    Please find the Attached Graphs

    Clock and CS:

    MOSI and CS:

    So, I am trying to read Device ID and Version. But MISO signal is disturbed.

    Here code:

    void dac_init(void)

    {

    GPIO_WritePin(DAC_RESETn, CLEAR);
    /* Delay for a bit */
    DELAY_US(1000); // 1msec
    GPIO_WritePin(DAC_RESETn, SET);

    }

    void loop(void)

    {

    dacWrite_Version(0x8100);         // Status

    }

  • Hi,

    I believe you have two issue right ? 

    1.  Device ID is not able to read

    2.  DAC output not updating  

    1st will discuss about Device ID read issue then later discuss about DAC output update.

    You mentioned that MISO signal get disturbed , meaning are you getting something not valid data at MISO ?  your captured image not showing MISO data. could you please share(CS,CLK,SDI, SDO) on signal screen. if you are suing 2ch scope 

    share SPI code of read device ID, what sequence are you following ?  did you enable SDO -EN bit at register 03

    Read device ID required 2 SPI cycles, 1s read command(write cycle), 2nd data read (read cycle)- refer Fig7-2   

  • Hello,

    Please find the attached Signals and Code

    Mode configured with Polarity: 0, Phase: 1

    void inti(void)

    {

    GPIO_WritePin(DAC_RESETn, CLEAR);
    /* Delay for a bit */
    DELAY_US(1000);// 1msec
    GPIO_WritePin(DAC_RESETn, SET);
    /* Power-up device */
    dac_init_steps(0x030004);

    }

    void loop(void)

    {

    dacWrite_Version(0x010000); // Status
    dacWrite_Version(0x810000); // Status

    }

    Trying to read Device ID and Version.

    CLK and CS

    MOSI: CLK and Data

    MISO: CLK and Data

  • Hi ,

    Could you please try is sequence and probe MISO.

    void loop(void)

    {

    dacWrite_Version(0x810000); // Status
    dacWrite_Version(0x810000); // Status 

    }

  • Not getting MISO data.

    Please any once share Devise ID and Version reference code.

    I am trying to Read Devise ID and Version getting problem.

    I am using EVM as it is. Just interface SPI signals CS, MISO, MOSI, SCLK, Reset, along with voltages

    I, J2 header pins shorted is it okay?

    Giving input supplies 

    J7.3 ---- GND

    J7.4-----VIO-----5V

    J7.5-----VDD/VAA-----5V

    J7.6 -----VSS-------GND

    J7.7-------VCC------30V

    Note: LDAC and CLR not used.

    Thank you Advance.

  • J2 header must be open

    J3 header must be open

  • J2 header mush be open, if shorted device in reset state.

  • Devise ID and Version reading done.

    Actually In TMS320f28379 EVM, SPI configuration as Polarity:0 Phase:1 working.

    Can you share example code for DAC out.

    Thank you.

  • Hello.

    I am trying to post on dac value. But not getting.

    Added Prepared code.

    void Dac_init(void)

    {

    GPIO_WritePin(DAC_RESETn, CLEAR);
    /* Delay for a bit */
    DELAY_US(1000);//delay(1);//~1mse
    GPIO_WritePin(DAC_RESETn, SET);

    //Configuration

    /* DACRANGEn Register A Range: +/- 20V */
    dac_init_steps(0x0acccc); 

    /* DACRANGEn Register B Range: +/- 20V */
    dac_init_steps(0x0bcccc); 
    dac_init_steps(0); /*Receive bytes */

    /* DACRANGEn Register C Range: +/- 20V */
    dac_init_steps(0x0ccccc); 

    /* DACRANGEn Register D Range: +/- 20V */
    dac_init_steps(0x0dcccc); 

    /* Power-up device */
    dac_init_steps(0x030a84);

    /* Power up all channels */
    dac_init_steps(0x090000);


    /* Enable Broadcast for all channels */
    dac_init_steps(0x05ffff);
    /* Write code to all channels */
    dac_init_steps(0x0fffff);

    }

    void loop(void)

    {

    dacWrite(0x107fff);

    DELAY_US(100);

    dacWrite(0x10ffff);

    DELAY_US(100);

    }

    Thank you,

  • Hi ,

    Good to hear that can fix code read issue . 

    I have couple of questions here.

    1.  I can understand that  you are  using TMS320f28379 EVM as host controller for SPI interface right ? 

    2.  Before going directly update DAC , i want to ensure you cable able to write the register without any issue? did you checked both read /write happening ? 

    Say for example , write a 0xAA55 data to register 0x05 address and read back your getting 0xAA55.

    0x05 -> 0xAA55 ; Write 

    0x05 -> < read data > ; should be 0xAA55.

     

     

  • Hello,

    1. Host is TMS320f28379  EVM

    2.Read and write is done.

    I am trying to post on dac value. But not getting.

  • Hi,

    I see from you setup VCC = 30 and VSS = 0V , DAC output voltage can be done uni-polar. 

    void Dac_init(void)

    {

    GPIO_WritePin(DAC_RESETn, CLEAR);

    /* Delay for a bit */

    DELAY_US(1000);//delay(1);//~1mse

    GPIO_WritePin(DAC_RESETn, SET);

     

     

    //Configuration

    /* DACRANGEn Register A Range: 0- 20V */ // updated as per your reference 30 V on VCC

    dac_init_steps(0x0a2222);      

    /* DACRANGEn Register B Range: 0- 20V */ updated as per your reference 30 V on VCC

    dac_init_steps(0x0b2222); 

    /* DACRANGEn Register C Range:0-20V */ updated as per your reference 30 V on VCC

    dac_init_steps(0x0c2222); 

    /* DACRANGEn Register D Range: 0- 20V */ updated as per your reference 30 V on VCC

    dac_init_steps(0x0d2222); 

     

     

    /* Power-up device */

    dac_init_steps(0x030a84);   //

    dac_init_steps(0x060000);   //  Add this line here DAC update with Async Mode

     

     

    /* Power up all channels */

    dac_init_steps(0x090000); //

     

    /* Enable Broadcast for all channels */

    dac_init_steps(0x05ffff);  // Brd cast enabled of all channed

    /* Write code to all channels */

    dac_init_steps(0x0f8000);    // Write DAC code to update all DAC for 10V  

     

    }

    Try this code , it will update all 16 channels.

  • Hello,

    Thank you for your Support.

    Shall we get Positive and Negative(Ex:+/-10) voltage on Single DAC out pin?

    If possible how to Configure Registers.

    Please Suggest me

    Thank you Advance...

  • Yes , do the following to get +/-10V output.

    Giving input supplies 

    J7.3 ---- GND

    J7.4-----VIO-----5V

    J7.5-----VDD/VAA-----5V

    J7.6 -----VSS >  - 10V

    J7.7-------VCC> + 10V

    ----------------------------------------

    void Dac_init(void)

    {

    GPIO_WritePin(DAC_RESETn, CLEAR);

    /* Delay for a bit */

    DELAY_US(1000);//delay(1);//~1mse

    GPIO_WritePin(DAC_RESETn, SET);

     

     

    //Configuration

    /* DACRANGEn Register A Range:+/-10V */ // VCC= +10V, VSS = -10V

    dac_init_steps(0x0aaaaa);      

    /* DACRANGEn Register B Range: +/-10V */VCC= +10V, VSS = -10V

    dac_init_steps(0x0baaaa); 

    /* DACRANGEn Register C Range:+/-10V */ VCC= +10V, VSS = -10V

    dac_init_steps(0x0caaaa); 

    /* DACRANGEn Register D Range: +/-10V */ VCC= +10V, VSS = -10V

    dac_init_steps(0x0daaaa); 

     

     

    /* Power-up device */

    dac_init_steps(0x030a84);   //

    dac_init_steps(0x060000);   //  Add this line here DAC update with Async Mode

     

     

    /* Power up all channels */

    dac_init_steps(0x090000); //

     

    /* Enable Broadcast for all channels */

    dac_init_steps(0x05ffff);  // Brd cast enabled of all channed

    /* Write code to all channels */

    dac_init_steps(0x0f8000);    // Write DAC code to update all DAC for 10V  

     

    }

    Hope this code will help to drive +/10V output.

  • please refer, DACRANGEn register for DAC range selection.