0
\$\begingroup\$

I need help figuring out how to interface the microcontroller Teensy 4.0 to three ADCs via SPI. The microcontroller only has 2 chip select pins according to its spec sheet. How can I connect to three slave devices with only 2 chip select pins? I know we can daisy chain them, but I prefer not to do that.

Link to Microcontroller: https://www.pjrc.com/store/teensy40.html Link to ADC data sheet:https://www.analog.com/media/en/technical-documentation/data-sheets/AD7606B.pdf

\$\endgroup\$
  • \$\begingroup\$ why do you prefer not to use a simple solution to your problem? \$\endgroup\$ – Roland Nov 4 '19 at 0:25
  • \$\begingroup\$ Most systems allow the use of any CS/SS pin... Since it is not really a high speed system. \$\endgroup\$ – MadHatter Nov 4 '19 at 1:37
  • 1
    \$\begingroup\$ Are you sure those CS pins are for master mode? Isn't it just for case when your microcontroller acts as a slave? \$\endgroup\$ – Chupacabras Nov 4 '19 at 8:50
1
\$\begingroup\$

Two bits is enough to encode the 4 states you need (each of 3 slave chips selected, and none selected). You can use a 2:4 decoder with active-low outputs such as the SN74LVC1G139. You may need to modify the software SPI driver to use an encoded CS output instead of the standard "one hot" style.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

If the micro-controller does not allow random CS/SS pins, consider running it through a 1:2 mux, and just set the correct chip using software before starting an SPI read/write. There are a lot of assumptions like hardware buffers etc. that the read/write will be done before you change the pin again...

Only use this method for occasional reads? Or with through testing...

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.