SPI Circuit help

See the attached picture of the circuit please. Here are the data sheets for reference.

http://www.mouser.com/ds/2/405/sn74hc165-407039.pdf

There is an awesome library [http://netmftoolbox.codeplex.com/] for working with shift registers and it has a great multi spi class for using multiple spi devices. I’ve used shift registers on boards in the past with great success but needed to add some analog ports this time. So I added the MCP3208 and got the PCB’s made :wall:! I brought it up on the scope when it wasn’t working and I’ve over looked some major problem. The shift registers all work fine and that is because, at idle the MISO pin on the MCP3208 is high z. Unfortunately Though, when the 74hc165 is at idle, the miso pin is high. This distorts the output of the MCP that the wave is too shallow and the bits aren’t registered.

This makes me wonder. What should the rest state of the MISO pin be? How is one meant to fully utilise the spi bus, if the first device on it holds the pin high or low? How Should I get around it? I’ve written off these boards that are probably not salvageable :frowning: . But how to fix it on the next board. I don’t have a spare spibus [G120]. Can I add an op-amp/relay/resistor or something. Need someone better at hardware than I am.

Thanks in advance.

Your 165 shift register is not really designed to use the SPI bus as there is no way for the output to tri-state, at least not with the 165 you are using. It will work if there is no other device on the bus but in your case, you have.

It is NOT a real SPI bus based device. Devices that support SPI allow the MISO line to go into the HIGH-Z state.

You are going to need to put in some kind of device that allows the output to TRI-STATE when the 165 is meant to be idle. I see that as your only option with this design.

What are you using the 165 for as I don’t see any connection to the D0-D7 connections anyway or does this CAD software not use NET labels?

1 Like

Thanks for the reply. I just cut all the other net names off so I would be more readable. I have another pin available but I have no spare spi. Could I use the other pin I’ve got to switch a tiny relay of some sort?

Use a tri-state buffer and control this with your CS for the 165. This little 1 gate device would do nicely if your CS is active high.

M74VHC1GT126DF2G

Or this one if your CS is active low.

NC7SZ125M5X

You legend, I’m a real noob at this stuff really. Never even heard of a buffer. :-[ , Looks perfect though, and it’s not to dear. probably much cheaper than changing the 165 for another more compatible part.