1
\$\begingroup\$

I'm working on a project where it would be very handy to be able to automatically switch a SPI flash chip between two different devices (a programmer, and the system that's actually using it).

Conceptually, this seems like a very simple task to me. I'd want a number of DPDT switches connected to the flash chip and both devices. I'd like to do this in a somewhat automated fashion (I don't want to have to flick a bunch of switches to do this), so I started looking into relays.

What kind of relay am I looking for here? I'm only looking at 3.3v here, so voltage shouldn't be a problem. Am I even looking for a relay, or is there some other type of device that would be more efficient? In total, there are 7 pins that I'd need to switch.

Due to limitations of the system being programmed, I cannot program the memory in circuit so something simple like a SOIC-CLIP would not be an option.

\$\endgroup\$
3
  • \$\begingroup\$ Seven? Why seven? \$\endgroup\$ Commented Jun 20, 2014 at 1:30
  • \$\begingroup\$ VCC, GND, DI, DO, SCK, CS, WP. WP might not be strictly required, but it improves reliability to have it connected \$\endgroup\$
    – devicenull
    Commented Jun 20, 2014 at 1:36
  • 1
    \$\begingroup\$ Having a signal connected to both devices may cause less of an issue than having it connected to some sort of switch. \$\endgroup\$ Commented Jun 20, 2014 at 1:45

2 Answers 2

2
\$\begingroup\$

I would recommend searching for buffers (or line drivers, transceivers) with tri-state functionality. Here is one example from NXP. They cost $0.57 USD each at DigiKey.

Basically, they act as simple buffers, but you can cause the outputs to become high-impedance and effectively disconnect the signals from your circuit. You would use two of them; one to connect (or disconnect) each of your devices. It is made easier because SPI lines, unlike I2C (for example), are each unidirectional.

There are hundreds of different ICs to choose from. For example, some have a single "Output Enable" (OE) line for all of the signals. Others have multiple OE's, allowing you to turn on/off only specfic signals. Some are inverting, some aren't, etc, etc. The architecture you need will depend on your specific circuit.

One thought: Perhaps you only need to switch your CS and WP lines? You may be able to leave the rest of the bus (including power) shared between both devices...

Good luck :)

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

Assuming that your programmer and your user system have identical operating voltages, just have your user-system make it's I/O lines high-impedance inputs; then the programmer can drive the SPI bus. The systems will need a common GND, of course. If for some reason you can't change the user system's behaviour, you should be able to get the same result by holding it in reset.

This approach will still work if your programmer requires a different operating voltage to the user system; just add a bidirectional level shifter like the TXB0106 to convert the bus voltages.

\$\endgroup\$

Your Answer

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

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