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.

DAC7568: Connection with Arduino

Part Number: DAC7568

Hello there!

I'm trying to communicate with a DAC7568 through Arduino code, using SPI, but I don't seem to get it right.

DAC pins LDAC, SYNC and CLR are defined through and MCP23S17 expander, with which I can communicate perfectly. So to define these pins, I need to send data to the expander first. So far, so good.

After that, I try to use the SPI library from Arduino to write to the DAC. I lower the SS pin, write SPI.begin() and after that SPI.transfer(...). 

Inside the SPI transfer I'm putting the 32-bits reffered on the DAC datasheet. But somewhere along these three lines I'm doing something wrong.

Can anyone explain me how I can make this work?

Thank you.

  • Howdy CatRato and welcome to the e2e forums!

    One item that will help with debug on our end is an oscilloscope capture of the SPI transaction. Is this something you can provide? Comparing the capture to the specifications listed in the datasheet should help with isolating the root cause.

    Best Regards,
    Matt
  • Good morning Matt and thank you!

    I'll only have access to an oscilloscope on the next weekend, right now I just have a digital multimeter. As soon as I'm able, I'll do it.

    Best Regards,
    Cátia
  • Howdy Catia,

    Just a follow up email to find out if your issue was resolved, or if you are able to provide the information requested.

    Best Regards,
    Matt
  • Hi there,

    The issue still persists.
    I'm sorry, I still wasn't able to go to the lab and get the oscilloscope info. I'll go there somewhere in the next two days and after that I'll post it here.

    Best Regards,
    Cátia
  • Matt,

    I went to the lab today and, in fact, the spi signals don't look like what were suposed.

    I only see some oscillation on the CS pin, I'm going to try and fix that. Because I'm able to communicate with the MCP23S17 expander, I thought everything was ok with the signal, but then I remembered I don't directly use the SPI with that chip.

    Thank you for your time,

    Cátia

  • Howdy Cátia,

    I'm glad that you found the root of your issue  Thank you for using e2e, and don't hesitate to reach out for future questions.

    Best Regards,

    Matt

  • Hi Matt,

    I'm really sorry I keep coming back, but I don't seem to be able to fix this. It's for my master thesis and I don't understand a lot about electronics. And I'm sorry for any english mistakes ahead.

    So, the SPI seems fine to me, but you can see some pictures and my arduino code here: www.dropbox.com/.../SPI.7z

    I'm using this class to control the mcp23s17 expander and everything looks good. The class itself uses SPI and every value I send to both ports can be measured withouth any problem. The values from LDAC, SYNC and CLR are passed through the expander to the dac pins (they can also be measured). 

    But I still don't see anything on the dac outputs.

    So I have two groups of pictures of the SPI Signal, the SPI1 refer to the ones without that bunch of Arduino code since the "digitalWrite(SS, LOW)" to the "digitalWrite(SS,HIGH)", which means the variations in the SPI signal come only from the expander. 

    The SPI2 group is the signal with the data I'm supposed to send to the DAC. 

    I've talked to two teachers and they keep telling me to ask for help here, so this is pretty much my last resource.

    Thank you for your time!

    Cátia

  • Howdy Catia,

    Can you include a copy of your schematic, with measured supply rails?  Additionally, can you attach the results from the previous post with the requested info and place it in a zip file (unfortunately my computer does not seem to like .7z files).  Once posted, I'll be sure to take a look at it and let you know if I'm able to spot anything out of the ordinary.

    Best Regards,

    Matt

  • Hello Matt,

    When you say "measured supply rails" do you mean the general circuit voltage or the individual component voltage? I don't know that expression, sorry.

    Best Regards,

    Cátia

  • Howdy Cátia,

    I just want to make sure that the supplies are coming up correctly, and at operational voltages.  A schematic of your setup would also be helpful for our debug efforts. Thanks again for your help.

    Best Regards,

    Matt

  • Hello Matt,

    Here is the info you requested.

    One thing I forgot to say was about the channels in the oscilloscope pictures: the 1st is the clock, the 2nd is data out, the 3rd is data in and the 4th is the chip select.

    Anything else you need, just say it.

    Thank you very much,

    Cátia

  • Cátia,

    You may want to put /CLR in the setup routine as opposed to the main loop, as this should be held permanently high, unless you wish to clear DACs to the coded clear code register value, which is by default 0V. Can you upload new oscilloscope pictures that are zoomed into the transaction? -- as the data in and clock edges are not easily readable. You can even split up the 32-bit transaction into 2 scope captures for maximum view-ability. The signals to capture are SCLK, SDI, /CS, /LDAC. You can additionally verify the state of the /CLR pin by providing another oscilloscope capture by probing the /CLR pin with SCLK, SDI, and /CS.

    Best Regards,
    Matt
  • Good morning Matt,

    I'll do some changes on the code to make sure of that.

    I'm working on having access to the CLR, SYNC and LDAC pins. With the current pcb "display", I can't connect the oscilloscope probes to the dac. It will take a few days but I'll get that info.

    Thank you for your time!

    Cátia

  • Hi Matt,

    I'm sorry it took so long.

    On this link you can see the requested info. I took 4 pictures because I had four segments of data. Channel 1 (yellow) is the SCK, channel 2 (blue) is SDI, channel 3 (pink) is SYNC and channel 4 is LDAC. Are these ok?

    I tried to put all DAC channels with 5 V, with no success.

    I think the waveforms are a little bit weird, I was expecting square waves, but that can be due to cable noise.

    Once again, thank you very much,

    Cátia

  • Hi Cátia,

    I will be helping you in resolving your issue now on as Matt is a bit busy.

    I went through this thread and understood that there is some issue with the SPI waveform generation, especially with the /CS waveform. However, I coudn't access the file in your last post. You can insert the oscilloscope images directly on the post rather than uploading them on to the cloud. We generally do not prefer file downloads from third-party cloud due to security reasons.

    If you doubt the signal integrity of the SPI waveform and you are not able to capture them properly on the scope, you can do one simple experiment to gain confidence. Please connect the SPI signals to another Arduino board that is configured for SPI in slave mode and read the data sent from the first board. This way you can validate the waveform. Once you are sure that all the data are as per the DAC specs, you can feed the signal to the DAC.

    Another point is that you are almost driving the IO exapnder at its highest frequency for SPI i.e. 10 MHz. You can try with a lower frequency first like 10 kHz or so and then increase the frequency if everything looks fine.

    Regards,

    Uttam

    Applications Engineer, Precision DACs