How can I connect more than 5 or 6 MCP4922 DAC using Raspberry Pi 2 Model B, if it is possible?
I saw SPI SDA GPIO Rspi.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityHow can I connect more than 5 or 6 MCP4922 DAC using Raspberry Pi 2 Model B, if it is possible?
I saw SPI SDA GPIO Rspi.
There are many ways.
I'd say the simplest is just to ignore the slave select signals used by the SPI driver and use your own.
E.g. say you have 6 DACs.
Find 6 spare GPIO. Let's say you use 22, 23, 24, 25, 5, and 6 (chosen as they are not used by SPI).
Connect DAC 1 slave select to 22
Connect DAC 2 slave select to 23
Connect DAC 3 slave select to 24
Connect DAC 4 slave select to 25
Connect DAC 5 slave select to 5
Connect DAC 6 slave select to 6
Write 1 to all those GPIO to deselect the DAC.
Connect the other SPI lines normally (i.e. MISO, MOSI, SCLK).
Then to talk to, say, DAC 4, write 0 to GPIO 25 to select DAC 4, call the SPI functions you want, write 1 to GPIO 25 to deselect DAC 4.
Repeat as needed for the other DACs.
E.g. in pigpio terms
h = pi.spi_open(0, 100000) # Get handle for all DACs at 100kbps.
# Use any legal channel, it will not be used.
...
# Write to DAC2
pi.write(23, 0) # Select DAC2.
pi.spi_xfer(h, [0, 95]) # Set DAC2 channel 0 to 95.
pi.write(23, 1) # Deselect DAC2.
...