Multiple MCP4922 SPI DACs on an Arduino
I’ve had a few days on and off fiddling with getting an Arduino Nano, trying to get it to talk to a couple of Microchip MCP4922 DACs hanging off the SPI bus.
The diagram over at the excellent tronixstuff site (in Arduino and the SPI bus part II) was a good starting point – essentially connect the clocks/data outputs to all the inputs, and use digital output pins for selecting the SPI slave to output to, but it still wasn’t having it.
The solution in the end was to attach pull-up resistors to the DAC chip select pins, like this.
I had a thought that it could be possible to use the internal pin pull-ups, but a discussion over at Society of Robots suggests that this might not be reliable. I don’t know if all SPI devices need a pull-up resistor on chip select, but from my experiments, the MCP4922 certainly does need it.
Here’s a quick and really irritating demo of four oscillators (“sines” from ASys RS-95, RS-95e and Doepfer A-111, triangle from Roland System 100 Model 101) being swept by the four outputs of the DACs – the resulting LFOs should each be 90 degrees out of phase. There’s also a pot wired to an analogue input, which controls the speed of the oscillations.
This is a spectrogram (from everyone’s favourite old PC sound editor from years back…) of part of the above demo which proves the phasing of the LFOs. One of the oscillators was tuned a lot lower, hence one of the lower peaks.
Must be turning into a hippy or something, I could stare at this spectrogram all day. I think I need an oscilloscope.