Post Go back to editing

AD5313R spi programming problem

I am testing a board that has a AD5313R DAC by bit banging the SPI signals.  I have LDAC and Gain tied to ground.  I am clocking the part at about 200 Hz (very low speed).  My problem is that occasionally when I set a value the output will go to zero or the output will turn off.  I can consistently program the DACB to 32 dec and then program it to 64 dec and the DACB output will turn off.  If I send a command to turn DACB on it has the correct output voltage for value of 64 dec.

 

I have a logic analyzer on the SPI bus and it does not show any issues.  Except when this happens the output voltages I program are correct.  I have some similar issues when programming DACA but I have repeated the above sequence many times.

 

I am using command 3 (Write to and update DAC Channel n) to program the DACs.

  • Hi Paul,

    A couple of questions:

    • What are your supply levels?
    • Instead of a logic analyzer, could you show the digital signal (clock and data lines) along with the output on an oscilloscope?
    • Also could you share the exact sequence of commands that you used?

    Regards,

    Mark

  •  

    Mark

     

    I am trying to reply again. The previous reply never made it.  The email reply feature does not work for me.

     

    Supply Voltage 3.3 VDC.

     

    I moved to my lab computer and repeated the result I had before.

     

    I sent a 32d value to DAC B and then recorded sending 64d to DAC B which also turns DAC B off.  When I send a command to turn DAC B on it has the correct voltage for a 64d value.

     

    I have also tried it with the clock nominally high with the same result.

     

    This is really weird.

     

    Paul

     

  • Hi Paul,

    Can you share your code how to configure SPI and send command and data to your DAC? I am new in this and I have a similar setup with yours. 

    Thanks in advance,

    Shuang

  • Hi Shuang,

    To be able to understand your situation more, I would like to ask a couple of questions:

    • What exactly would you want to implement? Is it the bit banging or the SPI configuration?
    • At stage are you in your project?
    • Are you also going to be using the AD5313R?
    • May we know which microcontroller are you planning on using to communicate to the parts?

    Regards,

    Mark

  • Hi Mark,

    Thank you for your response.
    I am using BF706, and SPI1 is interfacing with AD5313R. I want to use SPI1 MOSI to control DAC voltage, set it to half of the supply voltage. So my understanding is SPI1 MOSI should output a 2 byte data 0x0200 to DAC register, and 0x0031 is command and address for DAC.
    Here is my code. Please let me know what is wrong there:
    =======

    ADI_SPI_RESULT result;

    /* transceiver buffers */
    uint8_t Prologue[4];
    uint8_t TxBuffer[4] = {0x31, 0x00, 0x00, 0x02};
    uint8_t RxBuffer[4];

    /* transceiver configurations */
    ADI_SPI_TRANSCEIVER Transceiver1 = {&Prologue[0], 4, &TxBuffer[0], 4, &RxBuffer[0], 4};
    /* open the SPI driver */
    result = adi_spi_Open(1, SPIDriverMemory, (uint32_t)ADI_SPI_INT_MEMORY_SIZE, &hSpiDevice);

    /*
    * Use the driver API's to configure SPI
    */
    adi_spi_SetMaster(hSpiDevice, true); //LSB first
    adi_spi_SetHwSlaveSelect(hSpiDevice, true); //Slave select controlled by hardware
    adi_spi_SetSlaveSelect(hSpiDevice,ADI_SPI_SSEL_ENABLE1); //SPI slave select number
    adi_spi_SetWordSize(hSpiDevice, ADI_SPI_TRANSFER_16BIT);
    adi_spi_SetClock(hSpiDevice, 3U);

    /* No callbacks required*/
    result = adi_spi_RegisterCallback(hSpiDevice, NULL, NULL);

    /* Disable DMA */
    result = adi_spi_EnableDmaMode(hSpiDevice, false);

    /* submit the SPI transceiver's buffers */
    result = adi_spi_SubmitBuffer(hSpiDevice, &Transceiver1);

    =======

    Thank you in advance for your help,

    Shuang

  • Hi Shuang,

    I am afraid we do not provide support for the software. However, if you are having problems using the ADSP-BF706, you may post a question in the ADSP-BF70x sub-community under theBlackfin Processors community.

    For the DAC side of the questions, could you explain how the 0x0200 and 0x0031 will be a valid write to the SDI pin of the AD5313R? Please take note that the data sheet will require you to follow the input shift register content to communicate to the DAC as seen below.

    Regards,

    Mark

  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin