I'm trying to build an advanced pinball controller 
based on an Arduino DUE interfaced with:
- a microSD reader (3.3 Volt) for SPI INPUT/OUTPUT
- one or more MCP23S17 SPI I/O expander, for SPI OUTPUT only, which operates with 5V external logic
I set up the system as in the picture below.
The SPI clock is set at 1 Mhz.
As arduino DUE works at 3.3 V, I need an efficient logic level converter as interface with the MCP23S17.
My first choice was the TXB0108 bidirectional level shifter but I can't get the system working, with both microSD reader and the I/O expander operative. Only the microSD reader on its own would work, with the level converter disconnected.
Then I tried with the Sparkfun part n. 12009 (https://www.sparkfun.com/products/12009) but it failed as well.
I guessed that the problem could be a MISO signal conflict, while 23S17's output pin is in high-impedence state (when inactive). I then tried to disconnect the (unused) MISO connection as in the picture (with a red X). But again I've failed and the system does not work.
I tried to google around but I haven't found any solution.
Anyone can tell me what's the correct way to put together both 3.3V and 5V SPI slaves ?
Thank you.
spi trouble.pdf (107 KB)
I would use your first choice for the MISO line.
You would need to use the slave select inverted (like an inverting buffer) connected to the OE pin on that unit, When the slave select for the slave is HIGH, you want the OE line LOW, and vice versa. The slave select (and maybe the MOSI) would need to be on a separate converter that is not in a high impedance state when the slave select is HIGH.
That way the MISO line from the slave would be in a high impedance state when the slave select is HIGH and OE is LOW.
edit: It does seem a bit wasteful to use that 8 line device for one line. Maybe a tri-state logic device (74LVT126) may be more efficient. The slave select would still need to be inverted for the OE lines. The inputs are 5v tolerant and the outputs would be 3.3v for the Due.
http://www.nxp.com/documents/data_sheet/74LVT126.pdf
fabrz71:
I'm trying to build an advanced pinball controller 
based on an Arduino DUE interfaced with:
- a microSD reader (3.3 Volt) for SPI INPUT/OUTPUT
- one or more MCP23S17 SPI I/O expander, for SPI OUTPUT only, which operates with 5V external logic
I set up the system as in the picture below.
I tried to google around but I haven't found any solution.
Anyone can tell me what's the correct way to put together both 3.3V and 5V SPI slaves ?
Thank you.
Fabrz71,
attached is a working circuit to share SPI between a MEGA2560 5V with SDcard 3.3V, W25Q64F(Flash) 3.3V, MCP23s17 5V. It works fine using the default speeds. I got lazy and used the TXB0104 to send one of the CS lines to 3.3v. As long as you only drive the 3.3V CS's Low and use a pullup to 3.3v, change pinMode to Input for de-selection. It works.
On the Attachd screen grab VCC is 5v, VDD is 3.3.
The TXB0104 works just fine for me.
Chuck.
Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.
Thank you very much to both you. I will try the best solution as soon as possibile! Thanks again.