0
\$\begingroup\$

I'm designing a few PCBs for a project:

  • Microcontroller PCB (SPI master)
  • Sensor PCB, where each sensor PCB has several SPI slaves on it.

In a full system, there would be 3 sensor PCBs directly plugged into 3 connectors on the microcontroller PCB. In certain scenarios, not all 3 sensor PCBs will be present.

My question is about best practices/approach for sharing a single SPI controller across all 3 sensor PCBs. I'm planning to run the SPI bus at 20 MHz and the longest end-to-end trace length between the microcontroller and SPI slave will be about 8 inches.

Some ideas I had:

  1. Use a 'SPI bus multiplexer' to isolate which Sensor PCB is connected to the SPI bus at any given time, but haven't had much luck turning up results. Was hoping to find something similar to a TCA9544A (I2C multiplexer).
  2. Use 4-bit tri-state buffer on the microcontroller board for each Sensor PCB interface. In this case, I'd have 3 of these on the microcontroller PCB. Using the output enable to connect/disconnect a sensor PCB from the shared SPI bus.

Update:

Here's a diagram of what I'm trying to do:

enter image description here

I suppose I'm more concerned with signal integrity and EMI/reflections. I believe I have an understanding of the functional connection aspects. How should I handle the inter-board connections, given that a sensor board may or may not be attached? Should I use tri-state buffers at the interface?

\$\endgroup\$
1
  • 3
    \$\begingroup\$ SPI devices typically have a "chip select" line that does exactly that: make all devices on the bus inactive aside from the single one you want to address. Also, plenty of "analog switches" and "bus switches" can be used to multiplex SPI lines, nothing special. \$\endgroup\$ Mar 1, 2020 at 23:31

3 Answers 3

1
\$\begingroup\$

I believe the best approach would be to use SPI-controlled switches like ADGS1408 to select slave device on sensor PCB. This way same bus will be used for both communication and multiplexing. And you only need 1 additional wire per board - when it is low it selects switch itself, when it is high the inverted low signal is used as multiplexed SS for sensors.

So, to access certain sensor you first pull board SS low, send sensor address to a switch, then pull SS high and communicate with sensor.

On master PCB you can select active board directly from MCU (if you can spare pins) or you can add switch(es) to select between as many boards as you like. In this case you first send board address to local switch, then sensor address to selected board, and then communicate with selected sensor.

Note that if bus capacitance becomes a problem you can use switches to multiplex bus wires too. You only need two dual ADGS1409 to switch three bus wires and board SS.

\$\endgroup\$
0
\$\begingroup\$

question is about best practices/approach for sharing a single SPI controller across all 3 sensor PCBs.

The standard SPI configuration in most of the MCUs support multi slave configuration. Post the datasheet of the actual MCU and we can together see it.

enter image description here

The slave select lines will define which space device will actively use the rest of the bus. The other three lines can be shorter together.

\$\endgroup\$
2
  • \$\begingroup\$ You can also drive a priority decoder to save MCU pins. Only takes 3 pins to control 8 devices. \$\endgroup\$
    – DKNguyen
    Mar 2, 2020 at 3:05
  • \$\begingroup\$ Thanks! I updated my original post with a diagram to clarify. I'm more interested in how to maintain signal integrity and design for EMI/EMC when sharing the signal across multiple boards and when sometimes a board may be absent. \$\endgroup\$
    – MichaelC
    Mar 2, 2020 at 14:19
0
\$\begingroup\$

I would definitely avoid running a single SPI bus on 3 different boards without some sort of switching method.

I would suggest using the TS3A5018 4-bit analog switch from TI if your SPI's logic level falls between 1.8 and 3.6V.

Using a similar circuit to this one:

enter image description here

And the following logic:

enter image description here

You can effectively isolate the rest of the bus from the active path (eg. to the selected sensor) and avoid SI related issues. You also avoid running high-frequency content all over your system at once which should mitigate the emitted energy, and therefore, EMI concerns.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks! I think I will go this route. \$\endgroup\$
    – MichaelC
    Mar 5, 2020 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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