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.

DAC70504: SDO data reading problem

Part Number: DAC70504

Hello!

I am trying to write and read from registers on DAC70504EVM. I tried to write and then read from DAC0-DATA register (0x08).

As far as I understand from documentation (sbas871c.pdf), from tables on page 25, it is necessary to send (24-bits long) messages:

First I sent "write" message in order to write 0xEE value in DAC0-DATA register (0x08):

0 000 1000 0000000011101110

Then I was sending "read" messages in order to read respond from SDO:

1 000 1000 0000000000000000

The problem is that SDI pin (orange signal) is high all the time and it is not behaving as expected:


(SCLK - yellow, SDI - blue, SDO - orange, CS - green)

Also, I tried configuration where SCLKs are consecutively, the SDO behaviour is same:


(SCLK - yellow, SDI - blue, SDO - orange, CS - green)

The question is are the messages sent in the right way, and If not what I am doing wrong?

Best regards,
Marko

  • Hi Marko,

    Do you see the proper output on the DAC channel after writing 0xEE to the DAC0-DATA register? If now, we should start by debugging the write cycle first.

    As far as the read cycle, there should be two total access cycles, not including the original write to the register (when you are writing 0xEE). The first access is a read from the register, but the second is a dummy cycle is a dummy cycle of 24 bits. This dummy cycle can either be a write to another register, or the start of a read from another register. This is required so that the SDO (or MISO line) can clock back the data that was requested by the read command. Are you doing this second cycle? That might be the problem.

    Best,

    Katlynne Jones 

  • Hi Katlynne,

    The code is something like this:

      // ...
      
      // CS low
      USART_Tx( USART0, 0x08 );
      USART_Tx( USART0, 0x03 );
      USART_Tx( USART0, 0xEE );
      // CS high
    
      while( 1 )
      {
          // CS low
          USART_Tx( USART0, 0x88 );
          USART_Tx( USART0, 0x03 );
          USART_Tx( USART0, 0x00 );
          // CS high
      };
      
      // ...

    I will check the response output after writing 0xEE to the DAC0-DATA register.

    Ok, so in the while loop I should add one dummy cycle of 24 bits, after the read cycle. I will reply with oscilloscope pictures.

    Thank you Katlynne.

    Best regards,
    Marko

  • I'm adding a couple DAC70504s to my project and also using the DAC70504EVM. Is there any sample code for this part?

    Thanks!

    Jared

  • Hi Jared,

    We do not have example code. The DAC70504EVM has a GUI available but that might not help you with the other devices. We do have a header file for the family that was shared in this forum post: https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/924727/dac80501-source-code

    It should be easy to expand this to the 4 channel device by adding the extra data registers.

    Best,

    Katlynne

  • Hello Katlynne!

    I captured the data at the start of transmission process with trigger. Here is the picture:


    (SCLK - yellow, SDI - blue, SDO - orange)

    1. 0x0803EE
    2. 0x0903EE
    3. 0x880300
    4. 0x890300

    First I tried to write and then to read with dummy commands as you suggested, but there is no any answer from SDO.
    Have you any suggestion for the next steps in order to solve the problem?

    Best regards,
    Marko

  • Hi Marko,

    Thank you for trying with the dummy command. Were you able to confirm if the write command updated the DAC output?

    I took another look at your original oscilloscope shot that was more zoomed in and I think you might be using the wrong SPI mode. The SCLK can idle high or low (configured by the clock polarity), but the data needs to be shifted on the rising edge and captured on the falling edge (configured by the phase). So it's likely that the neither the read or write commands are actually working. Can you try modifying the SPI mode?

    Best,

    Katlynne Jones 

  • Hi Katlynne,

    The write command didn't update the DAC0 output. As it can be seen from the previous picture (with white arrows), SDO didn't respond with any data. Also when I checked voltage on J2[0] pin it wasn't giving the expected value.

    I will try modifying the SPI mode, and will inform you about results.
    If you think of another possible cause, please inform me.

    Best regards,
    Marko

  • Hi Katlynne,

    I brought the external power supply on VDD (3V). Then I executed this code:

        // ...
    
        GPIO_PinOutClear( US0CS_PORT, US0CS_PIN );
        USART_Tx( USART0, 0x08 ); // write
        USART_Tx( USART0, 0x03 );
        USART_Tx( USART0, 0xEE );
    
        USART_Tx( USART0, 0x00 ); // dummy
        USART_Tx( USART0, 0x00 );
        USART_Tx( USART0, 0x00 );
        GPIO_PinOutSet( US0CS_PORT, US0CS_PIN );
    
        while( 1 )
        {
          GPIO_PinOutClear( US0CS_PORT, US0CS_PIN );
          USART_Tx( USART0, 0x88 ); // read
          USART_Tx( USART0, 0x00 );
          USART_Tx( USART0, 0x00 );
          
          USART_Tx( USART0, 0x00 ); // dummy
          USART_Tx( USART0, 0x00 );
          USART_Tx( USART0, 0x00 );
          GPIO_PinOutSet( US0CS_PORT, US0CS_PIN );
      };

    So, the idea was to write some value in DAC0 register, and then to read that value in the loop. This is the oscilloscope picture from one while cycle (purple curly bracket):


    (SCLK - yellow, SDI - blue, SDO - orange, CS - green
    )

    So it can be seen that write command didn't configured DAC0 register successfully. Also tried to configure other registers with write command, but it wasn't successfully too.

    What could be next steps in solving this problem?

    About SPI mode, it looks good to me.


    (SCLK - yellow, SDO - orange)

    Best regards,
    Marko

  • Hi Marko,

    Katlynne will respond tomorrow.

  • Hi Marko,

    Make sure that CS is going high between every write/read command:

    Here's a timing diagram for the read:

    And the write to the DAC0 register might not be going through because that access cycle is more than 24 bits based on when you are toggling the CS pin:

    One last comment. You are using the DAC70504, right? The data is 14-bits and needs to be aligned left in the register. The last 2 bits in the register will be ignored:

    Best,

    Katlynne Jones