You know your an Engineer when this combination of ICONS means something exciting
Here is a link to the Second video in this short series Raspberry PI 2.0, Windows 10 and Diagnosing issues with the SPI bus when writing software for the DAC8734.
And here is the third Raspberry PI 2.0, Windows 10 and how to drive the DAC8734 from TI - Software review
OK, so its been a busy week learning, researching and creating sample content for the Raspberry PI using windows 10 to drive the DAC8734 Quad 16bit DAc from Texas Instruments
This was made more difficult becaue of the seeming lack of information outside of the actual datasheet for the chip wich can be found here;http://www.ti.com/lit/ds/symlink/dac8734.pdf
I also want to be clear, I dont have the DAC8734EVM to hand but I did get some DAC8734 Chips and mounted one on a breakout board and created my circuit on a bread board but there is nothing I am aware of that will prevent any of my software attached from working on the EVM
This is the EVM followed by my circuit
The objective of this post is to share my findings and experiance with the DAC8734, my initial intention was to evaluate it with regard to using it on my Power Supply Series and it just so happened to come up as a road test item also... Bonus.!!
I have created test programs for the Raspberry PI with Windows 10 for IOT (Detailed here), the Arduino UNO using the Arduino IDE and the TI LaunchPads (well several of them have been tested and there is very little difference between each one so only one sketch will be shown) and it was created using Enegia so anyone can use it with ease. even if there used to using only an Arduino.
So the featurs of the DAC8734 are many and most are integrated into my test program to evaluate their use
Right of the bat, the biggest two things I saw as a plus with this chip were the fact it was 16 bit, Quad channel and most of all can output upto 20V in unipolar mode or +10 to -10V in bipolar mode, Ideal for my power supply control or related projects.
This is the internal block diagram of the DAC and a bit more detail of one channel (There all the same)
One of the more interestng features are the calibration registers that allow the programmer to adjust the DAC for 0V and full scale by setting values into two registers that allow the scale of the dac to be changed up or down, even above the normal DAC max output volts (Software typically only allows adjustment up to the MAX of a DAC by tweeking hte binary value prior to writing to the DAC)
The DAC is also broken int to two halves, Group A and Group B, each group has seperate VREF and controls for Bipolar/Unipolar and Power Down.
This is the view of the application I am sharing, it follows the same basic design of the DAC, I have not gotton too cleaver with it, for instance you still can only input 0 - 65535 rather than an actual voltage, irrespective of the mode of operation, but this would be an easy thing for anyone to add if they wish (I may even do it later)
on the Windows 10 side of things, I will show (In the post related to the software review) how a splash screen can be added as well as setting the program to automatically start. I will attach the complete project for you to get to grips with on this post though, so you wont have to wait.
Here is a crude but informative wiring diagram showing how I connected up my version of the chip, A total of 6 wires from the PI, 3V3 and 0V power, then MOSI, MISO, CLK and CS for the SPI bus, I used CS1 on the PI for this sample.
So I have shown in the past using the PI with Windows 10 for IOT and driving SPI devices, and in those examples I was using Mode 0 of the SPI bus for clocking etc. I initially assumed as I was also using TI chips that this mode would also work with the DAC8734... Wrong, It took me a while to figure out what was wrong but eventually I did, thanks to my trusty MDO3054 scope and the SPI decode module to make life a little easier. The chip requires Mode 1 of operation
Here are two captured traces, one MODE 0 and one MODE 1, see if you can tell the difference without looking up the SPI standard . I will be posting a complete video and write up on this issue after this post and am keeping it seperate in order to keep the videos under an hour each (Yes I did hear you all from my previous posts). For now here is the teaser waveforms
I dont have the ability to measure the full acuracy, the low power mode consumption or the low noise claims for the DAC but im hoping one of the lucky road testers can do that and share their findings as I for sure am interested in so real world observations.
The DAC has the ability to work upto a 50Mhz SPI closk, this is not viable on a bread board but I was able to clock reliably upto 20Mhz, im sure if I shortened leads and improved termination this could go all the way and I am also sure that given the EVM board it will easily be achieved with the PI and any other able device.
One of the big issues I did observe while running under windows 10 for IOT was a very poor response to outputting a sine wave from an array of 256 16bit integers, I was able to get upto 250Hz on the arduino/Launchpads bit with the 1Ghz PI it was only able to complete a cycle of 256 points in 44mS resulting in a frequency of only 22Hz, so pretty bad really. I will be opening a ticket with MS regarding this and will keep you posted
Here are the timeing diagrams for one period (2 sample outputs), the three diagrams show the complete cycle, the first 24bit output and then a subsiquent one. As you can see, there is a significant delay between the end of the data being output and the chip select releasing.
So if being able to output 256 samples in 44mS seems reasonable, if I simply comment out the lowest level write to the SPI bus I can, it will complete 255 loops of 256 values in only about 33mS equating to about 7.7Khz so if this had efficient lower level drivers perhaps the PI would still be able to output a 256 sample waveform at about 5Khz, that would not be too bad. Lets see what MS has to say and also what the release builds due out in a week or two will show.
As best as I could measure, the DAC was pretty stable and accurate but I only have 4.5digit hand held DMMs to perform measurement and a 16bit dac with a better than 1LSB accuracy equates to about 152uV on a 10V scale which is about
10.000xxx 0.0015%and I could only check to 0.05% ish, which is still way good enough for power supplies and most other systems, unless your building metrology grade instruments or other systems demanding precision outputs. Again I look to the road testers to prove the capabilities down there.I do show my testing on the posts using the Arduino and Launchpads, I did not repeat it here as the cycle between compiling and testing was much longer and I have not built in calibration routines to the PI UI applicaton yet. so please refer to the pther posts (Up In the next few days) to see those findings. It was pretty impressive for sure.
So in summary for this post, I am most impressed with the DAC, it was relativly easy to integrate to the PI and windows 10 for IOT once I figured out the datasheet and the right mode to run the SPI bus in (And of course the time to write the code) and now it is done I have a base to extend on to more rich applications.
Please feel free to use this code as you wish, Visual Studio Community edition is all I used but untill the end of the month (July 2015) you will need to stick with the RC version and the current production version just release does not maintain compatability with the current version of the PI IOT firmware (Go Figure) but the MS docs state this will be rectified at the end of july along with the official release of Windows 10.
There may be a few minor bugs in the code but I have not done with it yet and if you try it and find some, please let me know and i will correct it. I will also be posting it up onto GITHUB for those that like that way of managing their code
You will also see other libraries I have written in the solution attached for ADC1115, DAC8574, MCP3208 that were the subject of previous posts as well as the DAC8734, feel free to play and use them as you wish.
Here is the video on Youtube, this contains much more commentry and a demo of the working program. I hope you enjoy
Top Comments