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.

Parents
  • 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

Reply
  • 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

Children
No Data