I intend to use the DAC8565 quad 16 bit DAC for the XM8, I've even bought 20 of them on breakout board and written a test - but for some reason, I haven't written anything about it.
Right now I'm making the final CV mux board, so I had to retest my program. For some reason though, it doesn't complie anymore?
In my code I'm using SPI.send24 as well as SPI.hasInterruptFlagSet, SPI.clearInterruptFlag and SPI.enableInterrupt.
I can't find ANYTHING about send24 anywhere, and very little about the others. But I found another SPI project locally, SPI-master, that has the send24 code. It says it is from https://www.pjrc.com/teensy/td_libs_SPI.html, but going there leads nowhere. Not sure what has happened, I feel completely gaslit!
Anyway - I copied the SPI-master into my project to get send24. As for the interrupt stuff, it's not really necessary as it only makes it possible to listen to send completes to trigger Load dac - and this can be done in software without penalty anyway, by adding it to the setting of the last DAC channel.
Ok, so how do we use the DAC8565.
The following pin config works:
pin 1,2, 7 and 8 are the four output channels
pin 3, Vref H, is the high reference voltage. It outputs the internal reference voltage (2.5V) if the internal voltage reference is used, and should be connected to ground through a 150nF cap. If using an external voltage reference instead, it can have an additional 4.8uF (!) cap to ground for reduced noise.
It is important to note that the max output when using the internal reference is 2.5V. To get a 5V output, we need to use an external 5V reference.
It is also important to note that the external reference CANNOT be higher than the Analog voltage AVDD, or the output will be clipped.
Pin 4, AVdd, power for the analog parts. It may be 3v3 if using the internal 2.5V reference as output, or 5V if using an external reference.
Pin 5, Vref L, the low reference voltage. Usually connected to GND
Pin 6, GND
Pin 9: !Sync. = SPI Chip select
Pin 10: Serial clock
Pin 11: D in, Serial data. Connect to master MOSI
Pin 12, IOVdd. This should match the logic level of the MCU, which for the Teensy is 3v3. However, I had some success setting this to 5V even with 3v3 output, but I get glitches when running the SPI bus at 50MHz. Also, it says in the spec sheet that 3v3 logic has a max bus speed of 25MHz (I have successfully used 50MHz on the current breadboarded circuit, and 46MHz earlier, but IOVdd must be 3v3.
I will try using 5V logic but that requires a high speed level shifter between the Teensy and the DAC.
Pin 13: !RST - when set to 0, all DAC outputs are reset to the value of RSTSEL
Pin 14: RSTSEL - reset select. If 0, DACs power up and reset to 0, if 1 they reset to the middle of the reference voltage.
Pin 15: !Enable - "Connects the SPI interface to serial port". This is currently confusing me though connecting it to 0 works fine.
Pin 16: LDAC: Load Dac. Connect to GND and control this through software or connect to MCU
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxEhMrb4hjuCSRWsmlm2G5YtEZqoD7D5mtMSzmlGWWI_2xBe7zt44JgWTDC8h0PV_EL1cgveEmf2w9azTKTsrTyo5VXvAOZIqgK0tCVmwcrU_BO9SozfnLJAs44Q5Mv-7JM6JsQmxGEupyX9LspKdB1nNCowniSsMn_4wCPGPuNTCSD_0U0-3ADLSMM852/s320/01%20-%20DAC8565%20IO3v3%20AV5%205V%20ext%20ref.png) |
Running a loop with IOVdd at 3v3, AVdd at 5V and using a 5V external reference
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmI6VtDoqWmdX_O2at_r6STGPC9fXUi2QWc3ByQcheE_vn3MyXCwKAQchhPXXPagB7pMnqwcXX1d1r3A2EGPGPd2i0j2reGzo7hgVH6HQ5xiPUIeyRgysDv3UCGoCGwTlkP4umUgA1G-8nm6l4rWGvrMLcEg0Td07jGFTc97css_MbqZmq5OEL5ddJK4jk/s320/02%20-%2050MHz%20working%20even%20with%203v3.png) |
50MHz SPI works fine
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9ZZk7ZzMIEZ9FdI2-QvJu_qExChALzb_9xsgQ2iROw8PV7249wL1U9UT443J8oqiGq4rslIR0dGzM2WsSZmMRXFol417N9_u6zjgl7jid7PifdcBcNMewfG0jLNVx9-OXc5HAa5IqDdeQRjFGvfbdT7MYLRE3tSU7nNRDQQLB2LTCR73MhOkqo8sK_N7q/s320/03%20-%20noisy%20output.png) |
There is significant noise on the output
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg06RAbcurEnKc_wK5g9qFVMxYK2nwBYIPQtmnxJOrhIlUqqY1GZyEatHVuGECtCwab6mLJNhnWw87ksjt5Jq9-Bl2wAUGsMq8SH2JIhOhQsZaxIzGqcCyVE2unwtZ9crlt0Rn8K3MIzd57fc58CfmyNjwTDi75FF7UinM4npvn2SX3zXI-mtH8bScZETIN/s320/04%20-%20noise%20is%20while%20SPI%20is%20running.png) |
The noise is however only while the SPI bus transfers. This may make it bearable even if present in the real circuit, as we can transfer the data and let the signal settle before turning on the output muxes that load the sample and hold caps.
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwA1ek8S8jCjPWbQU8jtWaItsXLYHw5E2nGQOE4ygoJynCb3zQu7G3E65IJt1OyMajQu3tSTqcU21D1iKHkUUH7hj6Gm41VI4-AVqmkIqfsdmhdjVXqqcWYXwjuiptGKQy72dLUnaN3iGqvYQ4LqlEp899sM6y_QT_ZAvC-UOfLUWXAomCziz9tSmFcrTc/s320/06%20-%205V%20IOV%20seems%20to%20work%20as%20well.png) |
5V IOVdd also works...
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijFWQ4jaIXdlhtd_L6QT1PQqCdyUqY2UjmBVbkBBF0X8ZhXOckCni986UZ-pbbupuCQBOxBajXsnCuDHX7whkkk1Vukvkd6VyczvbJ3Xb5AlhBY7Yl9c-3IjoxY45zef7Gi6xjhWGCQIDI7n0VCqgCtG3Qfij0nUD7eA8tjJuLd51QLQIOMpbHZ2rVMnaL/s320/07%20-%20Glitches!%20Running%2050MHz%203v3%20logic%20with%205V%20IOV.png) |
Unfortunately, we get glitches at 5V IOVdd
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDbrvx63MMJyHETsJCb3GEMAIxahyQCcZUGcI4VbHIPaI1cNxd5eYVHcad71YmVpsL_iJwa1W4KjZ3SAZrJhLe8Or3QS_Z9YJIBw_B2ytKYTK5Z-RtwHm5EP8WxEyXZfg4MbCwSdLsJdyayrvYeoEfc9YTh2x7dxAJejgUMSx0uAej1WJl3qHnX7qyOkjf/s320/08%20-%20No%20glitches,%20running%2050MHz%203v3%20logic%20with%203v3%20IOV.png) |
The glitches go away when reverting to 3v3IOVdd
|
With MUX
I spent a long time trying to get my 16ch CV buffer to work with the DAC. Turns out I had mislabeled pin D0, it should be next to D1, not next to GND.
Anyway, once I got that out of the way, the 16ch board works fine:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhppzBCHZ2nXBfBXOH4exd6EP3Ep2lJ5C7zJIIE6r5R6alx6QFo3TBvzbL2ACmgGQjrdi0wgj-HOh_9UsA4nnW5uD5Y8aMMTih0jzrVi5qFi0ac9tfgAWqyviE2Byg3liaCRyhySf_A_nMv1_9jaSbli-pL6DFc0fNmg0CdKk00yPEPeZ2zDNtn600rsjKL/s320/11%20-%20Working%2016%20channel%20output%20ext%205v%20ref%20opamp%20buffer%20470Ohm%20input.png) |
DAC Output through opamp buffer and 470R to mux. Works great!
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP7XDr6RTjv8VXC2TjTbmSXAMcJrWJy3xyknEa9hmnU2ipJYvforAENULRHkNS9REY7M36GiErBQsR2x68sn63pQ47qapYrRTpFR80SzdKJ2H8Ys3BHeUQfqWkYreq0BAhdVx4xAw7NitHLfI4r8clh7EXvIN79craw85EIHxCJXyVBvsHsjEl4x8eKapP/s320/13%20-%20Closeup%20including%20enable,%20very%20stable.png) |
Output is very stable. DAC slightly overshoots when switching (meastured after the buffer I think)
|
I tried various combinations:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggQeFeZ1XcJRhkyOoOKdbNcG8qMCGrYzQ1bZHtZF4Vli7bYhgED28VhDJVW5DgeBHY6o3jUFjNkd5FTM2DvVb0mRMDP2n2GX_J3wQv5ipNDxMbYS8XKojNTl4hM-035Ywp_xLwTb8r8Zh2G-C8UWdIFfOoccIJG68fkebi1ZZ35crjCcINdHVQ3RZnQjqz/s320/14%20-%205v%20ref%20470Ohm%20input%20no%20buffer.png) |
5V external reference, 470Ohm resistor directly to DAC |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA67u7M0jYe3PZ65fZDkckkYh-3IbzK-ch4eO5fyNgL2ZwC-gb3Itf5EsJztGdvqNjNDkbSRMblAROSqSXvZJ5-REoviUWUErTFFxigwR9XkaNPGJD_FvOELWIOOGDc57nlN3-v1M5FMrLLZob1qwz-PCgWfQgIx_RQhb_H-vSh0vxrx3NE8lvIWQAbD-1/s320/15%20-%205V%20ref%20no%20input%20res%20no%20buffer%20(direct%20from%20DAC%20to%20shift%20reg).png) |
5V external reference, no resistor, DAC directly to mux. DAC has no problem driving the charging
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv8yv7prdSkQjOdoQDslmDXbEpgrdApAkrs83NgG92oXt0oHFyXzfbzywqtmLYHU3uAUZYAcFAIMA-xTVM-KrP8gjAYjB6nfDqSBW9oRKA-xRN0Nn-2cMKNl2aN9vE1oolQrAVlHpz924_1qbXnI3sJeAE0UXFgQ7vNdd-zUXkd-TW9Ge9gdjF57giR_hU/s320/16%20-%20internal%202.5V%20ref%202x%20pos%20gain%20op%20amp%20470Ohm%20input.png) |
2.5V internal reference, 2x positive gain op amp, 470R input resistor
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPstVj0E_tBcHsHEb7pbzWr-EXCe7EXhBGaUjLcFivCiMYkgSolqS7pd1a3wMWur71D49WxQS-qLzLS88Bcun0ut7r33N0AwE8uhJOrj-kfRgzIF4MuDvRcYrluisJ56HQ_GyeTodiYBOZGFywRKnKhdyu9Ej_9Th0tRpcxo45lLjdkj0XkfeGGrcnUuNW/s320/18%20-%20internal%202.5v%20ref%202x%20pos%20amp%20no%20input%20res%20-%20no%20good!.png) |
5V external reference, 470R input, no buffer. Something is very wrong! Not sure exactly what.
|
Some closeups
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH60DD9TonUJyu7kiexetd2PMpN_2Bx7FQpkztzhGD-e2T2SVhhUSC3DMGtVXvkz_k7M8Whk_bc3fLcv8LCe7bsIgLbiuz9YUrYjQC09QRgypHIk5Ox-Mv6nkdCRlraKYQjIhS_WjnIhZdxNNCHb-AZp6wkBfjzWtzkeHXjAVymYMxh3MdJmKuJ7jh7UxL/s320/17%20-%20extreme%20closeup.png) |
Extreme closeup of 2.5V ref through 2x gain and 470R resistor.
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNCIMdf2KCsIyK0BJmBEOQzwgAg7-zKj_9OwO6TZZRZYVNnFgI4z37Q8RFN6a2WOrrSTRVYttNOojerrkK1-yIGMFr5_BrVC1Sk7joPB-F44ZBybMQ53QUMU32DeQrbK31WsVg5q7XB73SUttU-R-ur6TNqIOqLcnD7f4d-_Pc8S2USklaAGYfo7Zj5CfW/s320/19%20-%205v%20ref%20buffered%20470Ohm%20extreme%20closeup.png) |
Extreme closeup of 5V ref, buffered and 470R resistor. Pretty much the same
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi41JSwAqyZSSjLhDCerOZYgIvblg6GgvQBOPKi58nuZJYV29hRj5qthd_qPLznJ8iY3OQgT6j8V1zLNLX3UmX0QrBs9AMfp8frGnrpXDbaF5CobeIpsztTiOdkfvz5H0ZMMohmjZWdmE2FpAOuy7v7-QlQET-xf4hcWzT1coEcd2VcyzR-qnRre7HffPYc/s320/20%20-%205v%20ref%20direct%20from%20dac%20no%20resistor%20extreme%20closeup.png) |
Extreme closeup of 5V ref direct from dac without resistor. A tad noisier?
|
Then some charge times:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUE9YGDJ-BQaMFrHD1dL_si7O8CDONuBNR8cMikp3x_KbTsDD5a8gCX0fW9VZ65uAOjQDrZN3YNCjKfQEkRTQqObL1kz0SUp3R1Kf-q7VDSKCJAUimrDMulV2MuEGEiMvoxSJq5vCcv-rgmha0qGR7kEToCTV35zVqhtBzqYgmTlgYbngn1Zpm4AYsiY1r/s320/21%20-%205v%20ref%20direct%20from%20dac%20no%20resistor%20dac%20charging.png) |
Dac output when run as 5V ref direct from DAC without resistor. Rise time is around 5.5uS
|
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq2tknorRwPG44cof1gTlPLWbvNAHO8doRkoxKZdJCJESa8-f9HWxYQ6W0uJeiDcItbVNTzbUti-FclumOAx_guF-F3qjCauRXvl8GsvNU0LMVTq6_peBKB0LLFoutn05R9v0T-OGdDHV_TXXqE9ivNmfhiYbyrKNqdN1gssAcjXs9R5jTGhXnYZ9uKMjV/s320/22%20-%205v%20ref%20direct%20from%20dac%20no%20resistor%20cap%20charging.png.png) |
5V ref direct from DAC without resistor. Charge time 0 to 5V for CV buffer cap. Around 1.5uS
|
This is as far as I got, because here I somehow killed the Teensy :-( I would have liked to have the same two checks when running with 2.5V internal reference and 2x gain through 470R. Have to look for a new Teensy
...oh, I found one. Let's go on
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA3gdIErIKeqjc0cKl1Hk2g4QWU1d0hrv5o9GAiLAm27eitayRiCGpl4hbjkikU9LnG9fDVupus7yhqM2PYjbS1WTF5rnuo58Bm4OPcPAQzLl_rztrSqtUSkaUQVQ8nogtGLr5me82Bcr8bBmMgvTHVjbos9UdfuIghRAcM1gy-NG-ew4JNdyCLSu1PjC6/s320/24%20-%202.5V%20int%20ref%202x%20buffer%20470R%20resistor%20charge%20time.png) |
Cap charge time through 470R resistor, around 3.4uS
|
But what if we change to a 220R instead?
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjKzdZ2_REjOgrW-L8JK51iVgWyr063qvO6wMb7Ajp8AYzvlPunL6zC3HZA3XJWb_rX4MZHT9lmW0FCMaiFlGsRazDyVsKjxycRO-i8mjhVEYeWmdX6zA2RelBPMkctMuubAsaE1lo6IvBCATEu84NGKhcvVd-RsEsPSxpFsMRGbx3cz2xyrChUgxOZK-Y/s320/24%20-%202.5V%20int%20ref%202x%20buffer%20220R%20resistor%20charge%20time.png) |
Cap charge time through 220R resistor, around 2.2uS
|
That's pretty good. Let's look at the DAC settling time:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5wxgPsavpIO5aOQUKq3t2FVhgFimfunn6YLWN-p8rFQGGi38hSqlmGwLtxw0fLvV6z-CFgduS_SbyDnM7pP3d-LghyphenhyphenPVX_Byr5HPpCQx-JN4Wy3wNKNiFUTkdbUnZPv4CgckCHxUrM4g7HcX3tQvrKhLtVr8Ud7HBlWHnxR_v84Wb-06BBZNbEAXTOnPx/s320/25%20-%202.5V%20int%20ref%202x%20buffer%20dac%20load%20time%20as%20seen%20on%20mux%20input.png) |
Rise time from 0 to 5V, as seen at the output of the buffer after the DAC, is around 2.9uS. The drops in voltage coincides with the charging of the caps and are not present at the DAC output. |
|
All in all, this looks very promising. For my first production version I will use a 2x positive gain buffer with a 220R charging cap.