Electronic – 16bit DAC with 24bit SPI

dacspi

My design requires a 16-bit DAC with 100kS/s plus and SPI communication.
Strangely to me, the cheapest 16-bit DACs that meet the requirement (parametric search) have a 24-bit SPI word, like the AD5662 (pdf) I'm trying to use. The least significant 16-bits are the output value to update and the upper 8-bits are configuration (only 2 of the 8 are actually used). This mode of operation is inconvenient for my 16-bit micro-controller, as the associated ADC in the design has a 16-bit SPI word, ADC161S626 (pdf). This means my micro-controller needs to write x3 8-bit packets instead of x1 16-bit.

Why do manufactures do this? What would be the best way of perform the communication?

If both DAC and ADC were 16-bit SPI word I could read and write at the same time without having to reconfigure the SPI module and data in the micro-controller.

Best Answer

You are making too much of a minor inconvenience.

First, you probably can do two 16 bit transfers. The device will respond with zeros or garbage in the extra 8 bits, and you ignore them in your firmware.

However, the logical thing to do is three 8-bit transfers. Surely your micro can be set up to transfer 8-bit chunks.

At 100 kS/s, you have 10 µs per sample. That's a "long" time for SPI that can probably be clocked at 10 MHz (I didn't check the datasheet, but such speed is usually supported by such devices). Each bit therefore takes 100 ns. Transferring 24 bits therefore takes 2.4 µs just for the bits, plus a little overhead to select and de-select the chip.

Overall, you should be able to transfer the necessary data in about ¼ the available time, certainly within ⅓ the available time.

There is no problem here. You just have to architect the firmware up front, taking the specific characteristics of this D/A into account.

As for why the manufacturers do this? Two whole bytes are used for the data. You said yourself that some status and configuration is also transmitted, so that obviously takes at least a part of one more byte. Most SPI masters have hardware that transfers whole bytes, so they document the extra bits as being in a whole byte. They correctly realize this is really no big deal to firmware writers.